home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
backup
/
tktbacku.tar
/
tktbackup.tar
/
tktbackup-dist
/
tktbackup
< prev
next >
Wrap
Text File
|
1994-08-11
|
111KB
|
3,244 lines
#!/usr/local/bin/wish -f
# Program: tktbackup
# Tcl version: 7.3 (Tcl/Tk/XF)
# Tk version: 3.6
# XF version: 2.3
#
# module inclusion
global env
global xfLoadPath
global xfLoadInfo
set xfLoadInfo 0
if {[info exists env(XF_LOAD_PATH)]} {
if {[string first $env(XF_LOAD_PATH) /usr/local/lib/] == -1} {
set xfLoadPath $env(XF_LOAD_PATH):/usr/local/lib/
} {
set xfLoadPath /usr/local/lib/
}
} {
set xfLoadPath /usr/local/lib/
}
global argc
global argv
global tkVersion
set tmpArgv ""
for {set counter 0} {$counter < $argc} {incr counter 1} {
case [string tolower [lindex $argv $counter]] in {
{-xfloadpath} {
incr counter 1
set xfLoadPath "[lindex $argv $counter]:$xfLoadPath"
}
{-xfstartup} {
incr counter 1
source [lindex $argv $counter]
}
{-xfbindfile} {
incr counter 1
set env(XF_BIND_FILE) "[lindex $argv $counter]"
}
{-xfcolorfile} {
incr counter 1
set env(XF_COLOR_FILE) "[lindex $argv $counter]"
}
{-xfcursorfile} {
incr counter 1
set env(XF_CURSOR_FILE) "[lindex $argv $counter]"
}
{-xffontfile} {
incr counter 1
set env(XF_FONT_FILE) "[lindex $argv $counter]"
}
{-xfmodelmono} {
if {$tkVersion >= 3.0} {
tk colormodel . monochrome
}
}
{-xfmodelcolor} {
if {$tkVersion >= 3.0} {
tk colormodel . color
}
}
{-xfloading} {
set xfLoadInfo 1
}
{-xfnoloading} {
set xfLoadInfo 0
}
{default} {
lappend tmpArgv [lindex $argv $counter]
}
}
}
set argv $tmpArgv
set argc [llength $tmpArgv]
unset counter
unset tmpArgv
# procedure to show window ShowWindow.aboutBox
proc ShowWindow.aboutBox { args} {
# xf ignore me 7
# build widget .aboutBox
if {"[info procs XFEdit]" != ""} {
catch "XFDestroy .aboutBox"
} {
catch "destroy .aboutBox"
}
toplevel .aboutBox -background {#bfbfbf} -relief {raised}
# Window manager configurations
global tkVersion
wm positionfrom .aboutBox program
wm sizefrom .aboutBox program
wm geometry .aboutBox 366x154+132+147
wm title .aboutBox {About tktbackup!}
# build widget .aboutBox.aboutTktbackup
message .aboutBox.aboutTktbackup -aspect {1439} -background {#bfbfbf} -padx {5} -pady {2} -text { TkTbackup!
(c)1994 jon madison.
bug reports, comments to:
jonboy@neuromancer.ucr.edu
TkTbackup home page at:
http://indyunix.iupui.edu/~jmmadiso/tktbackup.html}
# build widget .aboutBox.okButton
button .aboutBox.okButton -activebackground {#bfbfbf} -background {#bfbfbf} -command {grab release .aboutBox ; DestroyWindow.aboutBox} -state {active} -text {Okey} -width {213}
# pack widget .aboutBox
pack append .aboutBox .aboutBox.aboutTktbackup {top frame center pady 13 expand} .aboutBox.okButton {top frame center expand}
if {"[info procs XFEdit]" != ""} {
catch "XFMiscBindWidgetTree .aboutBox"
after 2 "catch {XFEditSetShowWindows}"
}
}
proc DestroyWindow.aboutBox {} {# xf ignore me 7
if {"[info procs XFEdit]" != ""} {
if {"[info commands .aboutBox]" != ""} {
global xfShowWindow.aboutBox
set xfShowWindow.aboutBox 0
XFEditSetPath .
after 2 "XFSaveAsProc .aboutBox; XFEditSetShowWindows"
}
} {
catch "destroy .aboutBox"
update
}
}
# procedure to show window ShowWindow.filedescriptionwindow
proc ShowWindow.filedescriptionwindow { args} {
# xf ignore me 7
# build widget .filedescriptionwindow
if {"[info procs XFEdit]" != ""} {
catch "XFDestroy .filedescriptionwindow"
} {
catch "destroy .filedescriptionwindow"
}
toplevel .filedescriptionwindow -background {#bfbfbf} -borderwidth {3}
# Window manager configurations
global tkVersion
wm positionfrom .filedescriptionwindow program
wm sizefrom .filedescriptionwindow program
wm geometry .filedescriptionwindow 272x349+139+85
wm maxsize .filedescriptionwindow 470 412
wm minsize .filedescriptionwindow 10 10
wm title .filedescriptionwindow {Backup Description }
# build widget .filedescriptionwindow.okey
button .filedescriptionwindow.okey -activebackground {#bfbfbf} -background {#bfbfbf} -command {DestroyWindow.filedescriptionwindow} -font {-Adobe-Helvetica-medium-r-*-*-18-*-*-*-*-*-*-*} -state {active} -text {okey}
# build widget .filedescriptionwindow.backupdescription
text .filedescriptionwindow.backupdescription -background {#9100b3749f32} -borderwidth {4} -relief {sunken} -wrap {none}
# pack widget .filedescriptionwindow
pack append .filedescriptionwindow .filedescriptionwindow.okey {bottom frame center fillx} .filedescriptionwindow.backupdescription {bottom frame center fillx}
.filedescriptionwindow.backupdescription insert end {}
if {"[info procs XFEdit]" != ""} {
catch "XFMiscBindWidgetTree .filedescriptionwindow"
after 2 "catch {XFEditSetShowWindows}"
}
}
proc DestroyWindow.filedescriptionwindow {} {# xf ignore me 7
if {"[info procs XFEdit]" != ""} {
if {"[info commands .filedescriptionwindow]" != ""} {
global xfShowWindow.filedescriptionwindow
set xfShowWindow.filedescriptionwindow 0
XFEditSetPath .
after 2 "XFSaveAsProc .filedescriptionwindow; XFEditSetShowWindows"
}
} {
catch "destroy .filedescriptionwindow"
update
}
}
# procedure to show window .
proc ShowWindow. {args} {# xf ignore me 7
# Window manager configurations
global tkVersion
wm positionfrom . user
wm sizefrom . program
wm geometry . 639x471
wm maxsize . 639 482
wm minsize . 338 454
wm title . {tktbackup}
# bindings
bind . <Button-3> {MenuPopupPost .menu5 %X %Y}
bind . <ButtonRelease-3> {MenuPopupRelease .menu5 %W}
# build widget .topmenubar
frame .topmenubar \
-background {#a75ec168c312} \
-borderwidth {2} \
-relief {raised}
# build widget .topmenubar.menubutton1
menubutton .topmenubar.menubutton1 \
-activebackground {#a75ec168c312} \
-background {#a75ec168c312} \
-disabledforeground {#778d778d778d} \
-menu {.topmenubar.menubutton1.m} \
-text {File} \
-underline {0}
# build widget .topmenubar.menubutton1.m
menu .topmenubar.menubutton1.m \
-activebackground {#a75ec168c312} \
-background {#a75ec168c312} \
-disabledforeground {#778d778d778d}
.topmenubar.menubutton1.m add command \
-command {foo} \
-label {Load Config file...} \
-state {disabled} \
-underline {0}
.topmenubar.menubutton1.m add command \
-command {exit} \
-label {Save Config} \
-state {disabled} \
-underline {0}
.topmenubar.menubutton1.m add command \
-command {set temp [FSBox "save to *.arg file:" "$fsBox(path)/$fsBox(name)"]
if {[string length $temp] !=0 } {
set argfilename $temp
WriteVars $argfilename} } \
-label {Save Config As} \
-underline {1}
.topmenubar.menubutton1.m add separator
.topmenubar.menubutton1.m add command \
-command {ShowWindow.aboutBox;
grab aboutBox} \
-label {About tktbackup} \
-underline {6}
.topmenubar.menubutton1.m add command \
-command {catch [exec rm -f /tmp/.tktbackup.set] ;
.chooseMethodFrame.onemethodframe.enterdirset delete 0 end;
exit} \
-label {Exit} \
-underline {1}
# build widget .topmenubar.menubutton2
menubutton .topmenubar.menubutton2 \
-activebackground {#a75ec168c312} \
-background {#a75ec168c312} \
-menu {.topmenubar.menubutton2.m} \
-text {Help} \
-underline {0}
# build widget .topmenubar.menubutton2.m
menu .topmenubar.menubutton2.m \
-activebackground {#a75ec168c312} \
-background {#a75ec168c312}
.topmenubar.menubutton2.m add command \
-label {tbackup options...}
.topmenubar.menubutton2.m add command \
-command {ShowWindow.aboutBox ; grab .aboutBox} \
-label {About} \
-state {active}
# build widget .topmenubar.actionmenu
menubutton .topmenubar.actionmenu \
-activebackground {#a75ec168c312} \
-background {#a75ec168c312} \
-menu {.topmenubar.actionmenu.m} \
-text {Actions} \
-underline {1}
# build widget .topmenubar.actionmenu.m
menu .topmenubar.actionmenu.m \
-activebackground {#a75ec168c312} \
-background {#a75ec168c312}
.topmenubar.actionmenu.m add command \
-command {exec xterm -e tbackup -[file tail [file root $argfilename]] } \
-label {run tbackup} \
-underline {0}
# pack widget .topmenubar
pack append .topmenubar \
.topmenubar.menubutton1 {left frame center} \
.topmenubar.menubutton2 {right frame center} \
.topmenubar.actionmenu {left frame center}
# build widget .backuptypeframe
frame .backuptypeframe \
-background {#6dabd0e5c927} \
-borderwidth {2} \
-cursor {hand1} \
-relief {ridge}
# build widget .backuptypeframe.label3
label .backuptypeframe.label3 \
-background {#6dabd0e5c927} \
-font {-Adobe-Helvetica-Bold-R-*-*-14-*-*-*-*-*-*-*} \
-text {level: }
# build widget .backuptypeframe.full
radiobutton .backuptypeframe.full \
-activebackground {#64566bc666bc} \
-activeforeground {#e35ae5a19e72} \
-background {#6dabd0e5c927} \
-command {ForgetWindow .backuptypeframe.text1;
ForgetWindow .backuptypeframe.text2;
pack .backuptypeframe.text0 -side bottom -anchor w} \
-relief {ridge} \
-text {f} \
-value {f} \
-variable {level}
# build widget .backuptypeframe.incOnFull
radiobutton .backuptypeframe.incOnFull \
-activebackground {#64566bc666bc} \
-activeforeground {#e35ae5a19e72} \
-background {#6dabd0e5c927} \
-command {ForgetWindow .backuptypeframe.text0;
ForgetWindow .backuptypeframe.text2;
pack .backuptypeframe.text1 -side bottom -anchor w} \
-relief {ridge} \
-text {if} \
-value {if } \
-variable {level}
# build widget .backuptypeframe.incOnInc
radiobutton .backuptypeframe.incOnInc \
-activebackground {#64566bc666bc} \
-activeforeground {#e35ae5a19e72} \
-background {#6dabd0e5c927} \
-command {ForgetWindow .backuptypeframe.text0;
ForgetWindow .backuptypeframe.text1;
pack .backuptypeframe.text2 -side bottom -anchor w} \
-relief {ridge} \
-text {ii} \
-value {ii} \
-variable {level}
# build widget .backuptypeframe.text0
text .backuptypeframe.text0 \
-background {#6dabd0e5c927} \
-font {-*-utopia-medium-r-*-*-16-*-*-*-*-*-*-*} \
-height {1} \
-relief {raised} \
-wrap {none}
# bindings
bind .backuptypeframe.text0 <Any-Key> {{NoFunction}}
# build widget .backuptypeframe.text1
text .backuptypeframe.text1 \
-background {#6dabd0e5c927} \
-font {-*-utopia-medium-r-*-*-16-*-*-*-*-*-*-*} \
-height {1} \
-relief {raised} \
-wrap {none}
# bindings
bind .backuptypeframe.text1 <Any-Key> {{NoFunction}}
# build widget .backuptypeframe.text2
text .backuptypeframe.text2 \
-background {#6dabd0e5c927} \
-font {-*-utopia-medium-r-*-*-16-*-*-*-*-*-*-*} \
-height {1} \
-relief {raised} \
-wrap {none}
# bindings
bind .backuptypeframe.text2 <Any-Key> {{NoFunction}}
# pack widget .backuptypeframe
pack append .backuptypeframe \
.backuptypeframe.label3 {left frame nw fillx} \
.backuptypeframe.full {left frame nw} \
.backuptypeframe.incOnFull {left frame nw} \
.backuptypeframe.incOnInc {left frame nw} \
.backuptypeframe.text0 {bottom frame w}
# build widget .chooseMethodFrame
frame .chooseMethodFrame \
-background {#bfbfbf} \
-borderwidth {1} \
-geometry {37x213} \
-relief {sunken}
# build widget .chooseMethodFrame.frame
frame .chooseMethodFrame.frame \
-background {#b045bef9b801} \
-borderwidth {3} \
-relief {groove}
# build widget .chooseMethodFrame.frame.scrollbar2
scrollbar .chooseMethodFrame.frame.scrollbar2 \
-activeforeground {White} \
-background {#b045bef9b801} \
-command {.chooseMethodFrame.frame.listbox1 yview} \
-foreground {#b045bef9b801} \
-relief {sunken}
# build widget .chooseMethodFrame.frame.frame
frame .chooseMethodFrame.frame.frame \
-background {#b045bef9b801}
# build widget .chooseMethodFrame.frame.frame.scrollbar3
scrollbar .chooseMethodFrame.frame.frame.scrollbar3 \
-activeforeground {White} \
-background {#b045bef9b801} \
-command {.chooseMethodFrame.frame.listbox1 xview} \
-foreground {#b045bef9b801} \
-orient {horizontal} \
-relief {sunken}
# build widget .chooseMethodFrame.frame.frame.frame
frame .chooseMethodFrame.frame.frame.frame \
-background {#b045bef9b801} \
-geometry {19x19}
# pack widget .chooseMethodFrame.frame.frame
pack append .chooseMethodFrame.frame.frame \
.chooseMethodFrame.frame.frame.scrollbar3 {left frame center pady 8 expand fillx} \
.chooseMethodFrame.frame.frame.frame {left frame center padx 8}
# build widget .chooseMethodFrame.frame.label1
label .chooseMethodFrame.frame.label1 \
-background {#b045bef9b801} \
-font {-*-helvetica-medium-r-normal-*-12-*-*-*-p-*-iso8859-1} \
-foreground {#000000} \
-relief {ridge} \
-text {use backup set:} \
-width {28}
# build widget .chooseMethodFrame.frame.listbox1
listbox .chooseMethodFrame.frame.listbox1 \
-background {#b045bef9b801} \
-font {*-Courier-Medium-R-Normal--*-120-*} \
-foreground {#000000} \
-geometry {14x5} \
-relief {sunken} \
-xscrollcommand {.chooseMethodFrame.frame.frame.scrollbar3 set} \
-yscrollcommand {.chooseMethodFrame.frame.scrollbar2 set}
# bindings
bind .chooseMethodFrame.frame.listbox1 <B1-Motion> {%W select from [%W nearest %y]}
bind .chooseMethodFrame.frame.listbox1 <Button-1> {%W select from [%W nearest %y]}
bind .chooseMethodFrame.frame.listbox1 <ButtonRelease-1> {set setnameselection [selection get]}
bind .chooseMethodFrame.frame.listbox1 <Shift-B1-Motion> {%W select from [%W nearest %y]}
bind .chooseMethodFrame.frame.listbox1 <Shift-Button-1> {%W select from [%W nearest %y]}
# pack widget .chooseMethodFrame.frame
pack append .chooseMethodFrame.frame \
.chooseMethodFrame.frame.label1 {top frame center padx 47 fillx} \
.chooseMethodFrame.frame.frame {bottom frame center fillx} \
.chooseMethodFrame.frame.scrollbar2 {right frame center padx 8 filly} \
.chooseMethodFrame.frame.listbox1 {top frame center expand fill}
# build widget .chooseMethodFrame.chooseMethodButtonsFrame
frame .chooseMethodFrame.chooseMethodButtonsFrame \
-background {#bfbfbf} \
-borderwidth {4}
# build widget .chooseMethodFrame.chooseMethodButtonsFrame.label3
label .chooseMethodFrame.chooseMethodButtonsFrame.label3 \
-background {#c964af82d3f7} \
-font {-Adobe-Helvetica-Bold-R-*-*-14-*-*-*-*-*-*-*} \
-relief {raised} \
-text {Choose Method.}
# build widget .chooseMethodFrame.chooseMethodButtonsFrame.set
radiobutton .chooseMethodFrame.chooseMethodButtonsFrame.set \
-activebackground {#8c0495e9aac0} \
-background {#bfbfbf} \
-borderwidth {1} \
-command {pack .chooseMethodFrame.frame -side right -fill y -anchor nw ;
pack .chooseMethodFrame.rescansetlistbutton -side bottom -anchor s -expand 1;
ForgetWindow .chooseMethodFrame.onehelpframe .chooseMethodFrame.setRMhelpframe .chooseMethodFrame.onemethodframe ;
pack .chooseMethodFrame.sethelpframe -side left -anchor ne ;
FileInList .chooseMethodFrame.frame.listbox1 $setfiled} \
-text {set} \
-value {set} \
-variable {choosemethod}
# build widget .chooseMethodFrame.chooseMethodButtonsFrame.setrm
radiobutton .chooseMethodFrame.chooseMethodButtonsFrame.setrm \
-activebackground {#8c0495e9aac0} \
-background {#bfbfbf} \
-borderwidth {1} \
-command {pack .chooseMethodFrame.frame -side right -fill y -anchor nw;
pack .chooseMethodFrame.rescansetlistbutton -side bottom -anchor s -expand 1;
ForgetWindow .chooseMethodFrame.sethelpframe .chooseMethodFrame.onehelpframe .chooseMethodFrame.onemethodframe ;
pack .chooseMethodFrame.setRMhelpframe -side left -anchor ne ; FileInList .chooseMethodFrame.frame.listbox1 $setfiled} \
-text {setrm} \
-value {setrm} \
-variable {choosemethod}
# build widget .chooseMethodFrame.chooseMethodButtonsFrame.one
radiobutton .chooseMethodFrame.chooseMethodButtonsFrame.one \
-activebackground {#8c0495e9aac0} \
-background {#bfbfbf} \
-borderwidth {1} \
-command {ForgetWindow .chooseMethodFrame.frame .chooseMethodFrame.sethelpframe .chooseMethodFrame.setRMhelpframe .chooseMethodFrame.rescansetlistbutton ;
pack .chooseMethodFrame.onehelpframe -side top -anchor c ;
pack .chooseMethodFrame.onemethodframe -side top -anchor w} \
-text {one} \
-value {one} \
-variable {choosemethod}
# pack widget .chooseMethodFrame.chooseMethodButtonsFrame
pack append .chooseMethodFrame.chooseMethodButtonsFrame \
.chooseMethodFrame.chooseMethodButtonsFrame.label3 {top frame n padx 20 fill} \
.chooseMethodFrame.chooseMethodButtonsFrame.set {top frame n expand fill} \
.chooseMethodFrame.chooseMethodButtonsFrame.setrm {top frame n expand fill} \
.chooseMethodFrame.chooseMethodButtonsFrame.one {top frame n expand fill}
# build widget .chooseMethodFrame.sethelpframe
frame .chooseMethodFrame.sethelpframe \
-background {#bfbfbf} \
-borderwidth {2}
# build widget .chooseMethodFrame.sethelpframe.text1
text .chooseMethodFrame.sethelpframe.text1 \
-background {#bfbfbf} \
-borderwidth {6} \
-font {*-times-medium-r-*-*-14-*} \
-height {2} \
-width {28} \
-wrap {none}
# bindings
bind .chooseMethodFrame.sethelpframe.text1 <Any-Key> {NoFunction}
# pack widget .chooseMethodFrame.sethelpframe
pack append .chooseMethodFrame.sethelpframe \
.chooseMethodFrame.sethelpframe.text1 {top frame n fillx}
# build widget .chooseMethodFrame.setRMhelpframe
frame .chooseMethodFrame.setRMhelpframe \
-background {#bfbfbf} \
-borderwidth {2}
# build widget .chooseMethodFrame.setRMhelpframe.text1
text .chooseMethodFrame.setRMhelpframe.text1 \
-background {#bfbfbf} \
-borderwidth {8} \
-font {*-times-medium-r-*-*-14-*-*-*-*-*-*-*} \
-height {3} \
-width {28} \
-wrap {none}
# bindings
bind .chooseMethodFrame.setRMhelpframe.text1 <Any-Key> {NoFunction}
# pack widget .chooseMethodFrame.setRMhelpframe
pack append .chooseMethodFrame.setRMhelpframe \
.chooseMethodFrame.setRMhelpframe.text1 {top frame center fill}
# build widget .chooseMethodFrame.onehelpframe
frame .chooseMethodFrame.onehelpframe \
-background {#bfbfbf} \
-borderwidth {2}
# build widget .chooseMethodFrame.onehelpframe.text1
text .chooseMethodFrame.onehelpframe.text1 \
-background {#bfbfbf} \
-borderwidth {8} \
-font {*-times-medium-r-*-*-14-*-*-*-*-*-*-*} \
-height {2} \
-width {30} \
-wrap {none}
# bindings
bind .chooseMethodFrame.onehelpframe.text1 <Any-Key> {NoFunction}
# pack widget .chooseMethodFrame.onehelpframe
pack append .chooseMethodFrame.onehelpframe \
.chooseMethodFrame.onehelpframe.text1 {top frame nw padx 200 expand}
# build widget .chooseMethodFrame.rescansetlistbutton
button .chooseMethodFrame.rescansetlistbutton \
-activebackground {#afafaf} \
-background {#b232c51eb621} \
-borderwidth {3} \
-command {opensetfilelist /tmp/.tktbackup.set;
.chooseMethodFrame.frame.listbox1 delete 0 end ;
FileInList .chooseMethodFrame.frame.listbox1 /tmp/.tktbackup.set} \
-height {4} \
-text {Rescan Set List}
# build widget .chooseMethodFrame.onemethodframe
frame .chooseMethodFrame.onemethodframe \
-background {#bfbfbf} \
-borderwidth {2}
# build widget .chooseMethodFrame.onemethodframe.scrollbar0
scrollbar .chooseMethodFrame.onemethodframe.scrollbar0 \
-background {#bfbfbf} \
-command {.chooseMethodFrame.onemethodframe.enterdirset view} \
-foreground {#bfbfbf} \
-orient {horizontal} \
-relief {sunken} \
-width {11}
# build widget .chooseMethodFrame.onemethodframe.enterdirset
entry .chooseMethodFrame.onemethodframe.enterdirset \
-background {#b0e6cfdebadf} \
-font {-*-courier-bold-r-normal-*-15-*-*-*-*-*-*-*} \
-relief {sunken} \
-scrollcommand {.chooseMethodFrame.onemethodframe.scrollbar0 set} \
-width {35}
# pack widget .chooseMethodFrame.onemethodframe
pack append .chooseMethodFrame.onemethodframe \
.chooseMethodFrame.onemethodframe.enterdirset {top frame center} \
.chooseMethodFrame.onemethodframe.scrollbar0 {bottom frame center fillx}
# pack widget .chooseMethodFrame
pack append .chooseMethodFrame \
.chooseMethodFrame.chooseMethodButtonsFrame {left frame w pady 79 expand filly} \
.chooseMethodFrame.frame {right frame nw filly} \
.chooseMethodFrame.rescansetlistbutton {bottom frame s expand} \
.chooseMethodFrame.sethelpframe {left frame ne}
# build widget .packMethodsFrame
frame .packMethodsFrame \
-background {#6dabd0e5c927} \
-borderwidth {3} \
-cursor {hand1} \
-geometry {30x74} \
-relief {ridge}
# build widget .packMethodsFrame.label3
label .packMethodsFrame.label3 \
-background {#6dabd0e5c927} \
-font {-Adobe-Helvetica-Bold-R-*-*-14-*-*-*-*-*-*-*} \
-text {pack methods-> }
# build widget .packMethodsFrame.afio
radiobutton .packMethodsFrame.afio \
-activebackground {#64566bc666bc} \
-activeforeground {#e35ae5a19e72} \
-background {#6dabd0e5c927} \
-command {ForgetWindow .packMethodsFrame.text1 .packMethodsFrame.text7 .packMethodsFrame.text8 ; pack .packMethodsFrame.text0 -side bottom -anchor w} \
-relief {ridge} \
-text {afio} \
-value {afio} \
-variable {packmethod}
# build widget .packMethodsFrame.afio0
radiobutton .packMethodsFrame.afio0 \
-activebackground {#64566bc666bc} \
-activeforeground {#e35ae5a19e72} \
-background {#6dabd0e5c927} \
-command {ForgetWindow .packMethodsFrame.text0 .packMethodsFrame.text7 .packMethodsFrame.text8 ; pack .packMethodsFrame.text1 -side bottom -anchor w} \
-relief {ridge} \
-text {afio0} \
-value {afio0 } \
-variable {packmethod}
# build widget .packMethodsFrame.tar
radiobutton .packMethodsFrame.tar \
-activebackground {#64566bc666bc} \
-activeforeground {#e35ae5a19e72} \
-background {#6dabd0e5c927} \
-command {ForgetWindow .packMethodsFrame.text0 .packMethodsFrame.text1 .packMethodsFrame.text8; pack .packMethodsFrame.text7 -side bottom -anchor w} \
-relief {ridge} \
-text {tar} \
-value {tar} \
-variable {packmethod}
# build widget .packMethodsFrame.tarcpio
radiobutton .packMethodsFrame.tarcpio \
-activebackground {#64566bc666bc} \
-activeforeground {#e35ae5a19e72} \
-background {#6dabd0e5c927} \
-command {ForgetWindow .packMethodsFrame.text0 .packMethodsFrame.text1 .packMethodsFrame.text7 ; pack .packMethodsFrame.text8 -side bottom -anchor w} \
-relief {ridge} \
-text {tarcpio} \
-value {tarcpio} \
-variable {packmethod}
# build widget .packMethodsFrame.text0
text .packMethodsFrame.text0 \
-background {#6dabd0e5c927} \
-font {-*-utopia-medium-r-*-*-16-*-*-*-*-*-*-*} \
-height {1} \
-width {46}
# bindings
bind .packMethodsFrame.text0 <Any-Key> {{NoFunction}}
# build widget .packMethodsFrame.text1
text .packMethodsFrame.text1 \
-background {#6dabd0e5c927} \
-font {-*-utopia-medium-r-*-*-16-*-*-*-*-*-*-*} \
-height {1}
# bindings
bind .packMethodsFrame.text1 <Any-Key> {{NoFunction}}
# build widget .packMethodsFrame.text7
text .packMethodsFrame.text7 \
-background {#6dabd0e5c927} \
-font {-*-utopia-medium-r-*-*-16-*-*-*-*-*-*-*} \
-height {1}
# bindings
bind .packMethodsFrame.text7 <Any-Key> {{NoFunction}}
# build widget .packMethodsFrame.text8
text .packMethodsFrame.text8 \
-background {#6dabd0e5c927} \
-font {-*-utopia-medium-r-*-*-16-*-*-*-*-*-*-*} \
-height {1}
# bindings
bind .packMethodsFrame.text8 <Any-Key> {{NoFunction}}
# pack widget .packMethodsFrame
pack append .packMethodsFrame \
.packMethodsFrame.label3 {left frame nw fillx} \
.packMethodsFrame.afio {left frame nw} \
.packMethodsFrame.afio0 {left frame nw} \
.packMethodsFrame.tar {left frame nw} \
.packMethodsFrame.tarcpio {left frame nw} \
.packMethodsFrame.text0 {bottom frame w}
# build widget .writeMethodFrame
frame .writeMethodFrame \
-background {#bfbfbf} \
-borderwidth {1} \
-geometry {37x213} \
-relief {sunken}
# build widget .writeMethodFrame.writeMethodButtonFrame
frame .writeMethodFrame.writeMethodButtonFrame \
-background {#bfbfbf} \
-borderwidth {4}
# build widget .writeMethodFrame.writeMethodButtonFrame.label10
label .writeMethodFrame.writeMethodButtonFrame.label10 \
-background {#fef97cf07cf0} \
-font {-Adobe-Helvetica-*-r-*-*-14-*-*-*-*-*-*-*} \
-height {1} \
-relief {raised} \
-text {Write Methods...}
# build widget .writeMethodFrame.writeMethodButtonFrame.floppy
radiobutton .writeMethodFrame.writeMethodButtonFrame.floppy \
-activebackground {#8c0495e9aac0} \
-background {#bfbfbf} \
-borderwidth {1} \
-command {ForgetWindow .writeMethodFrame.message2;
ForgetWindow .writeMethodFrame.filedevframe ;
pack .writeMethodFrame.floppychoiceframe -anchor w -side left -expand 1} \
-height {2} \
-text {floppy} \
-value {floppy} \
-variable {writemethod}
# build widget .writeMethodFrame.writeMethodButtonFrame.tape
radiobutton .writeMethodFrame.writeMethodButtonFrame.tape \
-activebackground {#8c0495e9aac0} \
-background {#bfbfbf} \
-borderwidth {1} \
-command {ForgetWindow .writeMethodFrame.floppychoiceframe ;
ForgetWindow .writeMethodFrame.message2 ;
ForgetWindow .writeMethodFrame.filedevframe} \
-height {2} \
-text {tape} \
-value {tape} \
-variable {writemethod}
# build widget .writeMethodFrame.writeMethodButtonFrame.filedev
radiobutton .writeMethodFrame.writeMethodButtonFrame.filedev \
-activebackground {#8c0495e9aac0} \
-background {#bfbfbf} \
-borderwidth {1} \
-command {ForgetWindow .writeMethodFrame.floppychoiceframe ;
ForgetWindow .writeMethodFrame.message2 ;
pack .writeMethodFrame.filedevframe -side left -anchor c -expand 1} \
-height {2} \
-text {filedev} \
-value {filedev} \
-variable {writemethod}
# build widget .writeMethodFrame.writeMethodButtonFrame.bitbucket
radiobutton .writeMethodFrame.writeMethodButtonFrame.bitbucket \
-activebackground {#8c0495e9aac0} \
-background {#bfbfbf} \
-borderwidth {1} \
-command {ForgetWindow .writeMethodFrame.floppychoiceframe ;
ForgetWindow .writeMethodFrame.filedevframe ;
pack .writeMethodFrame.message2 -side left -anchor c} \
-height {2} \
-text {/dev/null} \
-value {null} \
-variable {writemethod}
# pack widget .writeMethodFrame.writeMethodButtonFrame
pack append .writeMethodFrame.writeMethodButtonFrame \
.writeMethodFrame.writeMethodButtonFrame.label10 {top frame center padx 20 fillx} \
.writeMethodFrame.writeMethodButtonFrame.floppy {top frame nw expand fill} \
.writeMethodFrame.writeMethodButtonFrame.tape {top frame nw expand fill} \
.writeMethodFrame.writeMethodButtonFrame.filedev {top frame nw expand fill} \
.writeMethodFrame.writeMethodButtonFrame.bitbucket {top frame center fillx}
# build widget .writeMethodFrame.floppychoiceframe
frame .writeMethodFrame.floppychoiceframe \
-background {#bfbfbf} \
-borderwidth {2} \
-relief {sunken}
# build widget .writeMethodFrame.floppychoiceframe.floppynameframe
frame .writeMethodFrame.floppychoiceframe.floppynameframe \
-background {#bfbfbf} \
-borderwidth {2}
# build widget .writeMethodFrame.floppychoiceframe.floppynameframe.floppylabel
label .writeMethodFrame.floppychoiceframe.floppynameframe.floppylabel \
-background {#bfbfbf} \
-borderwidth {0} \
-text {floppy device: }
# build widget .writeMethodFrame.floppychoiceframe.floppynameframe.floppy0
radiobutton .writeMethodFrame.floppychoiceframe.floppynameframe.floppy0 \
-activebackground {#e28ee28ee28e} \
-background {#bfbfbf} \
-relief {flat} \
-text {0} \
-value {0} \
-variable {mnr}
# build widget .writeMethodFrame.floppychoiceframe.floppynameframe.floppy1
radiobutton .writeMethodFrame.floppychoiceframe.floppynameframe.floppy1 \
-activebackground {#e28ee28ee28e} \
-background {#bfbfbf} \
-relief {flat} \
-text {1} \
-value {1} \
-variable {mnr}
# pack widget .writeMethodFrame.floppychoiceframe.floppynameframe
pack append .writeMethodFrame.floppychoiceframe.floppynameframe \
.writeMethodFrame.floppychoiceframe.floppynameframe.floppylabel {left frame center} \
.writeMethodFrame.floppychoiceframe.floppynameframe.floppy0 {left frame center} \
.writeMethodFrame.floppychoiceframe.floppynameframe.floppy1 {right frame center}
# build widget .writeMethodFrame.floppychoiceframe.densityframe
frame .writeMethodFrame.floppychoiceframe.densityframe \
-background {#bfbfbf} \
-borderwidth {2}
# build widget .writeMethodFrame.floppychoiceframe.densityframe.densitylabel
label .writeMethodFrame.floppychoiceframe.densityframe.densitylabel \
-background {#bfbfbf} \
-text {density: }
# build widget .writeMethodFrame.floppychoiceframe.densityframe.fd360
radiobutton .writeMethodFrame.floppychoiceframe.densityframe.fd360 \
-activebackground {#e28ee28ee28e} \
-background {#bfbfbf} \
-relief {flat} \
-text {d} \
-value {d} \
-variable {mdens}
# build widget .writeMethodFrame.floppychoiceframe.densityframe.fd1200
radiobutton .writeMethodFrame.floppychoiceframe.densityframe.fd1200 \
-activebackground {#e28ee28ee28e} \
-background {#bfbfbf} \
-relief {flat} \
-text {xd} \
-value {xd} \
-variable {mdens}
# build widget .writeMethodFrame.floppychoiceframe.densityframe.fd720
radiobutton .writeMethodFrame.floppychoiceframe.densityframe.fd720 \
-activebackground {#e28ee28ee28e} \
-background {#bfbfbf} \
-relief {flat} \
-text {h} \
-value {h} \
-variable {mdens}
# build widget .writeMethodFrame.floppychoiceframe.densityframe.fd1440
radiobutton .writeMethodFrame.floppychoiceframe.densityframe.fd1440 \
-activebackground {#e28ee28ee28e} \
-background {#bfbfbf} \
-relief {flat} \
-text {xh} \
-value {xh} \
-variable {mdens}
# pack widget .writeMethodFrame.floppychoiceframe.densityframe
pack append .writeMethodFrame.floppychoiceframe.densityframe \
.writeMethodFrame.floppychoiceframe.densityframe.densitylabel {left frame center} \
.writeMethodFrame.floppychoiceframe.densityframe.fd360 {left frame center} \
.writeMethodFrame.floppychoiceframe.densityframe.fd1200 {left frame center} \
.writeMethodFrame.floppychoiceframe.densityframe.fd720 {left frame center} \
.writeMethodFrame.floppychoiceframe.densityframe.fd1440 {left frame center}
# build widget .writeMethodFrame.floppychoiceframe.formatoptionsframe
frame .writeMethodFrame.floppychoiceframe.formatoptionsframe \
-background {#bfbfbf} \
-borderwidth {2}
# build widget .writeMethodFrame.floppychoiceframe.formatoptionsframe.format
checkbutton .writeMethodFrame.floppychoiceframe.formatoptionsframe.format \
-activebackground {#e28ee28ee28e} \
-background {#bfbfbf} \
-offvalue {n} \
-onvalue {y} \
-relief {flat} \
-text {format} \
-variable {formatalways}
# build widget .writeMethodFrame.floppychoiceframe.formatoptionsframe.verify_format
checkbutton .writeMethodFrame.floppychoiceframe.formatoptionsframe.verify_format \
-activebackground {#e28ee28ee28e} \
-background {#bfbfbf} \
-offvalue {n} \
-onvalue {y} \
-relief {flat} \
-text {verify format} \
-variable {verifyformat}
# build widget .writeMethodFrame.floppychoiceframe.formatoptionsframe.verify_after_write
checkbutton .writeMethodFrame.floppychoiceframe.formatoptionsframe.verify_after_write \
-activebackground {#e28ee28ee28e} \
-background {#bfbfbf} \
-offvalue {n} \
-onvalue {y} \
-relief {flat} \
-text {verify after write} \
-variable {verifywrite}
# pack widget .writeMethodFrame.floppychoiceframe.formatoptionsframe
pack append .writeMethodFrame.floppychoiceframe.formatoptionsframe \
.writeMethodFrame.floppychoiceframe.formatoptionsframe.format {top frame nw} \
.writeMethodFrame.floppychoiceframe.formatoptionsframe.verify_format {top frame nw} \
.writeMethodFrame.floppychoiceframe.formatoptionsframe.verify_after_write {top frame nw}
# build widget .writeMethodFrame.floppychoiceframe.showbackuplist
button .writeMethodFrame.floppychoiceframe.showbackuplist \
-activebackground {black} \
-activeforeground {#bfbfbf} \
-background {#bfbfbf} \
-borderwidth {3} \
-command {ShowWindow.filedescriptionwindow} \
-foreground {black} \
-relief {groove} \
-text {Show Backup Description.}
# pack widget .writeMethodFrame.floppychoiceframe
pack append .writeMethodFrame.floppychoiceframe \
.writeMethodFrame.floppychoiceframe.floppynameframe {top frame nw} \
.writeMethodFrame.floppychoiceframe.densityframe {top frame nw} \
.writeMethodFrame.floppychoiceframe.formatoptionsframe {top frame nw} \
.writeMethodFrame.floppychoiceframe.showbackuplist {top frame center}
# build widget .writeMethodFrame.message2
message .writeMethodFrame.message2 \
-aspect {167} \
-background {#bfbfbf} \
-font {-*-utopia-bold-i-*-*-30-*-100-75-*-*-*-*} \
-foreground {White} \
-justify {center} \
-padx {5} \
-pady {2} \
-text {To the Bit Bucket!}
# build widget .writeMethodFrame.filedevframe
frame .writeMethodFrame.filedevframe \
-background {#bfbfbf} \
-borderwidth {2}
# build widget .writeMethodFrame.filedevframe.scrollbar0
scrollbar .writeMethodFrame.filedevframe.scrollbar0 \
-background {#bfbfbf} \
-borderwidth {0} \
-command {.writeMethodFrame.filedevframe.enterdirset view} \
-foreground {#bfbfbf} \
-orient {horizontal} \
-relief {sunken} \
-width {11}
# build widget .writeMethodFrame.filedevframe.text1
text .writeMethodFrame.filedevframe.text1 \
-background {#bfbfbf} \
-borderwidth {8} \
-font {*-times-medium-r-*-*-14-*-*-*-*-*-*-*} \
-height {3} \
-width {30} \
-wrap {none}
# bindings
bind .writeMethodFrame.filedevframe.text1 <Any-Key> {NoFunction}
# build widget .writeMethodFrame.filedevframe.enterfiledev
entry .writeMethodFrame.filedevframe.enterfiledev \
-background {#ffffff0ea1ca} \
-font {-*-courier-bold-r-normal-*-15-*-*-*-*-*-*-*} \
-relief {sunken} \
-scrollcommand {.writeMethodFrame.filedevframe.scrollbar0 set} \
-width {35}
# pack widget .writeMethodFrame.filedevframe
pack append .writeMethodFrame.filedevframe \
.writeMethodFrame.filedevframe.text1 {top frame nw padx 200} \
.writeMethodFrame.filedevframe.enterfiledev {top frame w} \
.writeMethodFrame.filedevframe.scrollbar0 {bottom frame center fillx}
# build widget .writeMethodFrame.doIT
button .writeMethodFrame.doIT \
-activebackground {#fffff1260000} \
-background {#a0c49c1095ac} \
-borderwidth {4} \
-command {puts stdout $setnameselection ; exec xterm -e tbackup -this} \
-font {-*-*-demibold-i-*-*-24-*-*-*-*-*-*-*} \
-height {3} \
-text {DO IT!} \
-width {8}
# pack widget .writeMethodFrame
pack append .writeMethodFrame \
.writeMethodFrame.writeMethodButtonFrame {left frame w pady 82 expand filly} \
.writeMethodFrame.doIT {right frame se padx 139 expand} \
.writeMethodFrame.floppychoiceframe {left frame w expand}
# pack widget .
pack append . \
.topmenubar {top frame w fillx} \
.backuptypeframe {top frame center fillx} \
.chooseMethodFrame {top frame w expand fill} \
.packMethodsFrame {top frame w expand fill} \
.writeMethodFrame {bottom frame w expand fill}
global tkVersion
if {$tkVersion >= 3.0} {
tk_menuBar .topmenubar .topmenubar.menubutton1 .topmenubar.menubutton2 .topmenubar.actionmenu
} {
tk_menus . .topmenubar.menubutton1 .topmenubar.menubutton2 .topmenubar.actionmenu
}
.backuptypeframe.text0 insert end { full backup of all files in the set}
.backuptypeframe.text1 insert end { backup all files changed since last backup}
.backuptypeframe.text2 insert end { backup of files backed up since last incremental (if) backup}
.chooseMethodFrame.frame.listbox1 insert end {dos -- dos filesystem }
.chooseMethodFrame.frame.listbox1 insert end { ext -- extended filesystem. }
.chooseMethodFrame.frame.listbox1 insert end { foo -- a set called foo }
.chooseMethodFrame.frame.listbox1 insert end { mystuff -- my stuff in the /root directory. }
.chooseMethodFrame.frame.listbox1 insert end { nocdrom -- back up everything under / }
.chooseMethodFrame.frame.listbox1 insert end { system -- root filesystem, without /root dir.}
.chooseMethodFrame.sethelpframe.text1 insert end {set--back up a directory
set.}
.chooseMethodFrame.setRMhelpframe.text1 insert end {setrm--backup a directory
set and delete the files in
the set.}
.chooseMethodFrame.onehelpframe.text1 insert end {one--enter directory set
below (e.g. / or /dosc or /[whatever])}
.chooseMethodFrame.onemethodframe.enterdirset insert end {}
.packMethodsFrame.text0 insert end { afio--pack files with afio (best)}
.packMethodsFrame.text1 insert end { afio0--afio w/no compression}
.packMethodsFrame.text7 insert end { tar--use tar (no error recovery)}
.packMethodsFrame.text8 insert end { tarcpio--tar w/cpio (no compress)}
.writeMethodFrame.filedevframe.text1 insert end {filedev--enter file or device to
write to below (e.g. /tmp/hda1 or
/dev/tape or /[foo0]/[foo1], etc.)}
.writeMethodFrame.filedevframe.enterfiledev insert end {}
if {"[info procs XFEdit]" != ""} {
catch "XFMiscBindWidgetTree ."
after 2 "catch {XFEditSetShowWindows}"
}
}
# User defined procedures
# Procedure: FSBox
proc FSBox { {fsBoxMessage "Select file:"} {fsBoxFileName ""} {fsBoxActionOk ""} {fsBoxActionCancel ""}} {
# xf ignore me 5
##########
# Procedure: FSBox
# Description: show file selector box
# Arguments: fsBoxMessage - the text to display
# fsBoxFileName - a file name that should be selected
# fsBoxActionOk - the action that should be performed on ok
# fsBoxActionCancel - the action that should be performed on cancel
# Returns: the filename that was selected, or nothing
# Sideeffects: none
##########
#
# global fsBox(activeBackground) - active background color
# global fsBox(activeForeground) - active foreground color
# global fsBox(background) - background color
# global fsBox(font) - text font
# global fsBox(foreground) - foreground color
# global fsBox(extensions) - scan directory for extensions
# global fsBox(scrollActiveForeground) - scrollbar active background color
# global fsBox(scrollBackground) - scrollbar background color
# global fsBox(scrollForeground) - scrollbar foreground color
# global fsBox(scrollSide) - side where scrollbar is located
global fsBox
set fsBox(activeBackground) "#bfbfbf"
set fsBox(background) "#bfbfbf"
set fsBox(scrollBackground) "#bfbfbf"
set fsBox(scrollActiveForeground) "#bfbfbf"
set fsBox(scrollForeground) "#bfbfbf"
set fsBox(scrollSide) "right"
set fsBox(pattern) "*.arg"
set fsBox(path) "/etc/tbackup"
set tmpButtonOpt ""
set tmpFrameOpt ""
set tmpMessageOpt ""
set tmpScaleOpt ""
set tmpScrollOpt ""
if {"$fsBox(activeBackground)" != ""} {
append tmpButtonOpt "-activebackground \"$fsBox(activeBackground)\" "
}
if {"$fsBox(activeForeground)" != ""} {
append tmpButtonOpt "-activeforeground \"$fsBox(activeForeground)\" "
}
if {"$fsBox(background)" != ""} {
append tmpButtonOpt "-background \"$fsBox(background)\" "
append tmpFrameOpt "-background \"$fsBox(background)\" "
append tmpMessageOpt "-background \"$fsBox(background)\" "
}
if {"$fsBox(font)" != ""} {
append tmpButtonOpt "-font \"$fsBox(font)\" "
append tmpMessageOpt "-font \"$fsBox(font)\" "
}
if {"$fsBox(foreground)" != ""} {
append tmpButtonOpt "-foreground \"$fsBox(foreground)\" "
append tmpMessageOpt "-foreground \"$fsBox(foreground)\" "
}
if {"$fsBox(scrollActiveForeground)" != ""} {
append tmpScrollOpt "-activeforeground \"$fsBox(scrollActiveForeground)\" "
}
if {"$fsBox(scrollBackground)" != ""} {
append tmpScrollOpt "-background \"$fsBox(scrollBackground)\" "
}
if {"$fsBox(scrollForeground)" != ""} {
append tmpScrollOpt "-foreground \"$fsBox(scrollForeground)\" "
}
if {[file exists [file tail $fsBoxFileName]] &&
[IsAFile [file tail $fsBoxFileName]]} {
set fsBox(name) [file tail $fsBoxFileName]
} {
set fsBox(name) ""
}
if {[file exists $fsBoxFileName] && [IsADir $fsBoxFileName]} {
set fsBox(path) $fsBoxFileName
} {
if {"[file dirname $fsBoxFileName]" != "."} {
set fsBox(path) [file dirname $fsBoxFileName]
}
}
if {$fsBox(showPixmap)} {
set fsBox(path) [string trimleft $fsBox(path) @]
}
if {"$fsBox(path)" != "" && [file exists $fsBox(path)] &&
[IsADir $fsBox(path)]} {
set fsBox(internalPath) $fsBox(path)
} {
if {"$fsBox(internalPath)" == "" ||
![file exists $fsBox(internalPath)]} {
set fsBox(internalPath) [pwd]
}
}
# build widget structure
# start build of toplevel
if {"[info commands XFDestroy]" != ""} {
catch {XFDestroy .fsBox}
} {
catch {destroy .fsBox}
}
toplevel .fsBox -borderwidth 0
catch ".fsBox config $tmpFrameOpt"
wm geometry .fsBox 350x300
wm title .fsBox {Save your configuration to a file.}
wm maxsize .fsBox 1000 1000
wm minsize .fsBox 100 100
# end build of toplevel
label .fsBox.message1 -anchor c -relief raised -text "$fsBoxMessage"
catch ".fsBox.message1 config $tmpMessageOpt"
frame .fsBox.frame1 -borderwidth 0 -relief raised
catch ".fsBox.frame1 config $tmpFrameOpt"
button .fsBox.frame1.ok -text "OK" -command "
global fsBox
set fsBox(name) \[.fsBox.file.file get\]
if {$fsBox(showPixmap)} {
set fsBox(path) @\[.fsBox.path.path get\]
} {
set fsBox(path) \[.fsBox.path.path get\]
}
set fsBox(internalPath) \[.fsBox.path.path get\]
$fsBoxActionOk
if {\"\[info commands XFDestroy\]\" != \"\"} {
catch {XFDestroy .fsBox}
} {
catch {destroy .fsBox}
}"
catch ".fsBox.frame1.ok config $tmpButtonOpt"
button .fsBox.frame1.rescan -text "Rescan" -command {
global fsBox
FSBoxFSShow [.fsBox.path.path get] [.fsBox.pattern.pattern get] $fsBox(all)}
catch ".fsBox.frame1.rescan config $tmpButtonOpt"
button .fsBox.frame1.cancel -text "Cancel" -command "
global fsBox
set fsBox(name) {}
set fsBox(path) {}
$fsBoxActionCancel
if {\"\[info commands XFDestroy\]\" != \"\"} {
catch {XFDestroy .fsBox}
} {
catch {destroy .fsBox}
}"
catch ".fsBox.frame1.cancel config $tmpButtonOpt"
if {$fsBox(showPixmap)} {
frame .fsBox.frame2 -borderwidth 0 -relief raised
catch ".fsBox.frame2 config $tmpFrameOpt"
scrollbar .fsBox.frame2.scrollbar3 -command {.fsBox.frame2.canvas2 xview} -orient {horizontal} -relief {raised}
catch ".fsBox.frame2.scrollbar3 config $tmpScrollOpt"
scrollbar .fsBox.frame2.scrollbar1 -command {.fsBox.frame2.canvas2 yview} -relief {raised}
catch ".fsBox.frame2.scrollbar1 config $tmpScrollOpt"
canvas .fsBox.frame2.canvas2 -confine {true} -relief {raised} -scrollregion {0c 0c 20c 20c} -width {100} -xscrollcommand {.fsBox.frame2.scrollbar3 set} -yscrollcommand {.fsBox.frame2.scrollbar1 set}
catch ".fsBox.frame2.canvas2 config $tmpFrameOpt"
.fsBox.frame2.canvas2 addtag currentBitmap withtag [.fsBox.frame2.canvas2 create bitmap 5 5 -anchor nw]
}
frame .fsBox.path -borderwidth 0 -relief raised
catch ".fsBox.path config $tmpFrameOpt"
frame .fsBox.path.paths -borderwidth 2 -relief raised
catch ".fsBox.path.paths config $tmpFrameOpt"
menubutton .fsBox.path.paths.paths -borderwidth 0 -menu ".fsBox.path.paths.paths.menu" -relief flat -text "Pathname:"
catch ".fsBox.path.paths.paths config $tmpButtonOpt"
menu .fsBox.path.paths.paths.menu
catch ".fsBox.path.paths.paths.menu config $tmpButtonOpt"
.fsBox.path.paths.paths.menu add command -label "[string trimright $fsBox(internalPath) {/@}]" -command "
global fsBox
FSBoxFSShow \[.fsBox.path.path get\] \[.fsBox.pattern.pattern get\] \$fsBox(all)
.fsBox.path.path delete 0 end
.fsBox.path.path insert 0 [string trimright $fsBox(internalPath) {/@}]"
entry .fsBox.path.path -relief raised
catch ".fsBox.path.path config $tmpMessageOpt"
if {![IsADir $fsBox(internalPath)]} {
set $fsBox(internalPath) [pwd]
}
.fsBox.path.path insert 0 $fsBox(internalPath)
frame .fsBox.pattern -borderwidth 0 -relief raised
catch ".fsBox.pattern config $tmpFrameOpt"
frame .fsBox.pattern.patterns -borderwidth 2 -relief raised
catch ".fsBox.pattern.patterns config $tmpFrameOpt"
menubutton .fsBox.pattern.patterns.patterns -borderwidth 0 -menu ".fsBox.pattern.patterns.patterns.menu" -relief flat -text "Selection pattern:"
catch ".fsBox.pattern.patterns.patterns config $tmpButtonOpt"
menu .fsBox.pattern.patterns.patterns.menu
catch ".fsBox.pattern.patterns.patterns.menu config $tmpButtonOpt"
.fsBox.pattern.patterns.patterns.menu add checkbutton -label "Scan extensions" -variable fsBox(extensions) -command {
global fsBox
FSBoxFSShow [.fsBox.path.path get] [.fsBox.pattern.pattern get] $fsBox(all)}
entry .fsBox.pattern.pattern -relief raised
catch ".fsBox.pattern.pattern config $tmpMessageOpt"
.fsBox.pattern.pattern insert 0 $fsBox(pattern)
frame .fsBox.files -borderwidth 0 -relief raised
catch ".fsBox.files config $tmpFrameOpt"
scrollbar .fsBox.files.vscroll -relief raised -command ".fsBox.files.files yview"
catch ".fsBox.files.vscroll config $tmpScrollOpt"
scrollbar .fsBox.files.hscroll -orient horiz -relief raised -command ".fsBox.files.files xview"
catch ".fsBox.files.hscroll config $tmpScrollOpt"
listbox .fsBox.files.files -exportselection false -relief raised -xscrollcommand ".fsBox.files.hscroll set" -yscrollcommand ".fsBox.files.vscroll set"
catch ".fsBox.files.files config $tmpMessageOpt"
frame .fsBox.file -borderwidth 0 -relief raised
catch ".fsBox.file config $tmpFrameOpt"
label .fsBox.file.labelfile -relief raised -text "Filename:"
catch ".fsBox.file.labelfile config $tmpMessageOpt"
entry .fsBox.file.file -relief raised
catch ".fsBox.file.file config $tmpMessageOpt"
.fsBox.file.file delete 0 end
.fsBox.file.file insert 0 $fsBox(name)
checkbutton .fsBox.pattern.all -offvalue 0 -onvalue 1 -text "Show all files" -variable fsBox(all) -command {
global fsBox
FSBoxFSShow [.fsBox.path.path get] [.fsBox.pattern.pattern get] $fsBox(all)}
catch ".fsBox.pattern.all config $tmpButtonOpt"
FSBoxFSShow $fsBox(internalPath) $fsBox(pattern) $fsBox(all)
# bindings
bind .fsBox.files.files <Double-Button-1> "
FSBoxFSFileSelectDouble %W $fsBox(showPixmap) \{$fsBoxActionOk\} %y"
bind .fsBox.files.files <ButtonPress-1> "
FSBoxFSFileSelect %W $fsBox(showPixmap) %y"
bind .fsBox.files.files <Button1-Motion> "
FSBoxFSFileSelect %W $fsBox(showPixmap) %y"
bind .fsBox.files.files <Shift-Button1-Motion> "
FSBoxFSFileSelect %W $fsBox(showPixmap) %y"
bind .fsBox.files.files <Shift-ButtonPress-1> "
FSBoxFSFileSelect %W $fsBox(showPixmap) %y"
bind .fsBox.path.path <Tab> {
FSBoxFSNameComplete path}
bind .fsBox.path.path <Return> {
global tkVersion
global fsBox
FSBoxFSShow [.fsBox.path.path get] [.fsBox.pattern.pattern get] $fsBox(all)
FSBoxFSInsertPath
if {$tkVersion >= 3.0} {
.fsBox.file.file icursor end
} {
.fsBox.file.file cursor end
}
focus .fsBox.file.file}
catch "bind .fsBox.path.path <Up> {}"
bind .fsBox.path.path <Down> {
global tkVersion
if {$tkVersion >= 3.0} {
.fsBox.file.file icursor end
} {
.fsBox.file.file cursor end
}
focus .fsBox.file.file}
bind .fsBox.file.file <Tab> {
FSBoxFSNameComplete file}
bind .fsBox.file.file <Return> "
global fsBox
set fsBox(name) \[.fsBox.file.file get\]
if {$fsBox(showPixmap)} {
set fsBox(path) @\[.fsBox.path.path get\]
} {
set fsBox(path) \[.fsBox.path.path get\]
}
set fsBox(internalPath) \[.fsBox.path.path get\]
$fsBoxActionOk
if {\"\[info commands XFDestroy\]\" != \"\"} {
catch {XFDestroy .fsBox}
} {
catch {destroy .fsBox}
}"
bind .fsBox.file.file <Up> {
global tkVersion
if {$tkVersion >= 3.0} {
.fsBox.path.path icursor end
} {
.fsBox.path.path cursor end
}
focus .fsBox.path.path}
bind .fsBox.file.file <Down> {
global tkVersion
if {$tkVersion >= 3.0} {
.fsBox.pattern.pattern icursor end
} {
.fsBox.pattern.pattern cursor end
}
focus .fsBox.pattern.pattern}
bind .fsBox.pattern.pattern <Return> {
global fsBox
FSBoxFSShow [.fsBox.path.path get] [.fsBox.pattern.pattern get] $fsBox(all)}
bind .fsBox.pattern.pattern <Up> {
global tkVersion
if {$tkVersion >= 3.0} {
.fsBox.file.file icursor end
} {
.fsBox.file.file cursor end
}
focus .fsBox.file.file}
catch "bind .fsBox.pattern.pattern <Down> {}"
# packing
pack append .fsBox.files .fsBox.files.vscroll "$fsBox(scrollSide) filly" .fsBox.files.hscroll {bottom fillx} .fsBox.files.files {left fill expand}
pack append .fsBox.file .fsBox.file.labelfile {left} .fsBox.file.file {left fill expand}
pack append .fsBox.frame1 .fsBox.frame1.ok {left fill expand} .fsBox.frame1.rescan {left fill expand} .fsBox.frame1.cancel {left fill expand}
pack append .fsBox.path.paths .fsBox.path.paths.paths {left}
pack append .fsBox.pattern.patterns .fsBox.pattern.patterns.patterns {left}
pack append .fsBox.path .fsBox.path.paths {left} .fsBox.path.path {left fill expand}
pack append .fsBox.pattern .fsBox.pattern.patterns {left} .fsBox.pattern.all {right fill} .fsBox.pattern.pattern {left fill expand}
if {$fsBox(showPixmap)} {
pack append .fsBox.frame2 .fsBox.frame2.scrollbar1 {left filly} .fsBox.frame2.canvas2 {top expand fill} .fsBox.frame2.scrollbar3 {top fillx}
pack append .fsBox .fsBox.message1 {top fill} .fsBox.frame1 {bottom fill} .fsBox.pattern {bottom fill} .fsBox.file {bottom fill} .fsBox.path {bottom fill} .fsBox.frame2 {right fill} .fsBox.files {left fill expand}
} {
pack append .fsBox .fsBox.message1 {top fill} .fsBox.frame1 {bottom fill} .fsBox.pattern {bottom fill} .fsBox.file {bottom fill} .fsBox.path {bottom fill} .fsBox.files {left fill expand}
}
if {"$fsBoxActionOk" == "" && "$fsBoxActionCancel" == ""} {
# wait for the box to be destroyed
update idletask
grab .fsBox
tkwait window .fsBox
if {"[string trim $fsBox(path)]" != "" ||
"[string trim $fsBox(name)]" != ""} {
if {"[string trimleft [string trim $fsBox(name)] /]" == ""} {
return [string trimright [string trim $fsBox(path)] /]
} {
return [string trimright [string trim $fsBox(path)] /]/[string trimleft [string trim $fsBox(name)] /]
}
}
}
}
# Procedure: FSBoxBindSelectOne
proc FSBoxBindSelectOne { fsBoxW fsBoxY} {
# xf ignore me 6
set fsBoxNearest [$fsBoxW nearest $fsBoxY]
if {$fsBoxNearest >= 0} {
$fsBoxW select from $fsBoxNearest
$fsBoxW select to $fsBoxNearest
}
}
# Procedure: FSBoxFSFileSelect
proc FSBoxFSFileSelect { fsBoxW fsBoxShowPixmap fsBoxY} {
# xf ignore me 6
global fsBox
FSBoxBindSelectOne $fsBoxW $fsBoxY
set fsBoxNearest [$fsBoxW nearest $fsBoxY]
if {$fsBoxNearest >= 0} {
set fsBoxTmpEntry [$fsBoxW get $fsBoxNearest]
if {"[string index $fsBoxTmpEntry [expr [string length $fsBoxTmpEntry]-1]]" == "/" ||
"[string index $fsBoxTmpEntry [expr [string length $fsBoxTmpEntry]-1]]" == "@"} {
set fsBoxFileName [string range $fsBoxTmpEntry 0 [expr [string length $fsBoxTmpEntry]-2]]
if {![IsADir [string trimright $fsBox(internalPath)/$fsBoxFileName @]] &&
![IsASymlink [string trimright $fsBox(internalPath)/$fsBoxFileName @]]} {
set fsBoxFileName $fsBoxTmpEntry
}
} {
if {"[string index $fsBoxTmpEntry [expr [string length $fsBoxTmpEntry]-1]]" == "*"} {
set fsBoxFileName [string range $fsBoxTmpEntry 0 [expr [string length $fsBoxTmpEntry]-2]]
if {![file executable $fsBox(internalPath)/$fsBoxFileName]} {
set fsBoxFileName $fsBoxTmpEntry
}
} {
set fsBoxFileName $fsBoxTmpEntry
}
}
if {![IsADir [string trimright $fsBox(internalPath)/$fsBoxFileName @]]} {
set fsBox(name) $fsBoxFileName
.fsBox.file.file delete 0 end
.fsBox.file.file insert 0 $fsBox(name)
if {$fsBoxShowPixmap} {
catch ".fsBox.frame2.canvas2 itemconfigure currentBitmap -bitmap \"@$fsBox(internalPath)/$fsBox(name)\""
}
}
}
}
# Procedure: FSBoxFSFileSelectDouble
proc FSBoxFSFileSelectDouble { fsBoxW fsBoxShowPixmap fsBoxAction fsBoxY} {
# xf ignore me 6
global fsBox
FSBoxBindSelectOne $fsBoxW $fsBoxY
set fsBoxNearest [$fsBoxW nearest $fsBoxY]
if {$fsBoxNearest >= 0} {
set fsBoxTmpEntry [$fsBoxW get $fsBoxNearest]
if {"$fsBoxTmpEntry" == "../"} {
set fsBoxTmpEntry [string trimright [string trim $fsBox(internalPath)] "@/"]
if {"$fsBoxTmpEntry" == ""} {
return
}
FSBoxFSShow [file dirname $fsBoxTmpEntry] [.fsBox.pattern.pattern get] $fsBox(all)
.fsBox.path.path delete 0 end
.fsBox.path.path insert 0 $fsBox(internalPath)
} {
if {"[string index $fsBoxTmpEntry [expr [string length $fsBoxTmpEntry]-1]]" == "/" ||
"[string index $fsBoxTmpEntry [expr [string length $fsBoxTmpEntry]-1]]" == "@"} {
set fsBoxFileName [string range $fsBoxTmpEntry 0 [expr [string length $fsBoxTmpEntry]-2]]
if {![IsADir [string trimright $fsBox(internalPath)/$fsBoxFileName @]] &&
![IsASymlink [string trimright $fsBox(internalPath)/$fsBoxFileName @]]} {
set fsBoxFileName $fsBoxTmpEntry
}
} {
if {"[string index $fsBoxTmpEntry [expr [string length $fsBoxTmpEntry]-1]]" == "*"} {
set fsBoxFileName [string range $fsBoxTmpEntry 0 [expr [string length $fsBoxTmpEntry]-2]]
if {![file executable $fsBox(internalPath)/$fsBoxFileName]} {
set fsBoxFileName $fsBoxTmpEntry
}
} {
set fsBoxFileName $fsBoxTmpEntry
}
}
if {[IsADir [string trimright $fsBox(internalPath)/$fsBoxFileName @]]} {
set fsBox(internalPath) "[string trimright $fsBox(internalPath) {/@}]/$fsBoxFileName"
FSBoxFSShow $fsBox(internalPath) [.fsBox.pattern.pattern get] $fsBox(all)
.fsBox.path.path delete 0 end
.fsBox.path.path insert 0 $fsBox(internalPath)
} {
set fsBox(name) $fsBoxFileName
if {$fsBoxShowPixmap} {
set fsBox(path) @$fsBox(internalPath)
} {
set fsBox(path) $fsBox(internalPath)
}
if {"$fsBoxAction" != ""} {
eval "global fsBox; $fsBoxAction"
}
if {"[info commands XFDestroy]" != ""} {
catch {XFDestroy .fsBox}
} {
catch {destroy .fsBox}
}
}
}
}
}
# Procedure: FSBoxFSInsertPath
proc FSBoxFSInsertPath {} {
# xf ignore me 6
global fsBox
set fsBoxLast [.fsBox.path.paths.paths.menu index last]
set fsBoxNewEntry [string trimright [.fsBox.path.path get] "/@"]
for {set fsBoxCounter 0} {$fsBoxCounter <= $fsBoxLast} {incr fsBoxCounter 1} {
if {"$fsBoxNewEntry" == "[lindex [.fsBox.path.paths.paths.menu entryconfigure $fsBoxCounter -label] 4]"} {
return
}
}
if {$fsBoxLast < 9} {
.fsBox.path.paths.paths.menu add command -label "$fsBoxNewEntry" -command "
global fsBox
FSBoxFSShow $fsBoxNewEntry \[.fsBox.pattern.pattern get\] \$fsBox(all)
.fsBox.path.path delete 0 end
.fsBox.path.path insert 0 $fsBoxNewEntry"
} {
for {set fsBoxCounter 0} {$fsBoxCounter < $fsBoxLast} {incr fsBoxCounter 1} {
.fsBox.path.paths.paths.menu entryconfigure $fsBoxCounter -label [lindex [.fsBox.path.paths.paths.menu entryconfigure [expr $fsBoxCounter+1] -label] 4]
.fsBox.path.paths.paths.menu entryconfigure $fsBoxCounter -command "
global fsBox
FSBoxFSShow [lindex [.fsBox.path.paths.paths.menu entryconfigure [expr $fsBoxCounter+1] -label] 4] \[.fsBox.pattern.pattern get\] \$fsBox(all)
.fsBox.path.path delete 0 end
.fsBox.path.path insert 0 [lindex [.fsBox.path.paths.paths.menu entryconfigure [expr $fsBoxCounter+1] -label] 4]"
}
.fsBox.path.paths.paths.menu entryconfigure $fsBoxLast -label "$fsBoxNewEntry"
.fsBox.path.paths.paths.menu entryconfigure $fsBoxCounter -command "
global fsBox
FSBoxFSShow \[.fsBox.path.path get\] \[.fsBox.pattern.pattern get\] \$fsBox(all)
.fsBox.path.path delete 0 end
.fsBox.path.path insert 0 $fsBoxNewEntry"
}
}
# Procedure: FSBoxFSNameComplete
proc FSBoxFSNameComplete { fsBoxType} {
# xf ignore me 6
global tkVersion
global fsBox
set fsBoxNewFile ""
if {"$fsBoxType" == "path"} {
set fsBoxDirName [file dirname [.fsBox.path.path get]]
set fsBoxFileName [file tail [.fsBox.path.path get]]
} {
set fsBoxDirName [file dirname [.fsBox.path.path get]/]
set fsBoxFileName [file tail [.fsBox.file.file get]]
}
set fsBoxNewFile ""
if {[IsADir [string trimright $fsBoxDirName @]]} {
catch "glob -nocomplain $fsBoxDirName/${fsBoxFileName}*" fsBoxResult
foreach fsBoxCounter $fsBoxResult {
if {"$fsBoxNewFile" == ""} {
set fsBoxNewFile [file tail $fsBoxCounter]
} {
if {"[string index [file tail $fsBoxCounter] 0]" !=
"[string index $fsBoxNewFile 0]"} {
set fsBoxNewFile ""
break
}
set fsBoxCounter1 0
set fsBoxTmpFile1 $fsBoxNewFile
set fsBoxTmpFile2 [file tail $fsBoxCounter]
set fsBoxLength1 [string length $fsBoxTmpFile1]
set fsBoxLength2 [string length $fsBoxTmpFile2]
set fsBoxNewFile ""
if {$fsBoxLength1 > $fsBoxLength2} {
set fsBoxLength1 $fsBoxLength2
}
while {$fsBoxCounter1 < $fsBoxLength1} {
if {"[string index $fsBoxTmpFile1 $fsBoxCounter1]" == "[string index $fsBoxTmpFile2 $fsBoxCounter1]"} {
append fsBoxNewFile [string index $fsBoxTmpFile1 $fsBoxCounter1]
} {
break
}
incr fsBoxCounter1 1
}
}
}
}
if {"$fsBoxNewFile" != ""} {
if {[IsADir [string trimright $fsBoxDirName/$fsBoxNewFile @]] ||
![IsAFile [string trimright $fsBoxDirName/$fsBoxNewFile @]]} {
if {[IsADir [string trimright $fsBoxDirName/$fsBoxNewFile @]]} {
if {"$fsBoxDirName" == "/"} {
.fsBox.path.path delete 0 end
.fsBox.path.path insert 0 "/[string trimright [string trim $fsBoxNewFile /] @]/"
} {
.fsBox.path.path delete 0 end
.fsBox.path.path insert 0 "[string trimright $fsBoxDirName /]/[string trimright [string trim $fsBoxNewFile /] @]/"
}
FSBoxFSShow [.fsBox.path.path get] [.fsBox.pattern.pattern get] $fsBox(all)
FSBoxFSInsertPath
} {
.fsBox.path.path delete 0 end
.fsBox.path.path insert 0 "[string trimright $fsBoxDirName /]/[string trimright [string trim $fsBoxNewFile /] @]"
}
} {
.fsBox.path.path delete 0 end
.fsBox.path.path insert 0 "[string trimright $fsBoxDirName {@/}]/"
.fsBox.file.file delete 0 end
.fsBox.file.file insert 0 $fsBoxNewFile
if {$tkVersion >= 3.0} {
.fsBox.file.file icursor end
} {
.fsBox.file.file cursor end
}
focus .fsBox.file.file
}
}
}
# Procedure: FSBoxFSShow
proc FSBoxFSShow { fsBoxPath fsBoxPattern fsBoxAll} {
# xf ignore me 6
global fsBox
set tmpButtonOpt ""
if {"$fsBox(activeBackground)" != ""} {
append tmpButtonOpt "-activebackground \"$fsBox(activeBackground)\" "
}
if {"$fsBox(activeForeground)" != ""} {
append tmpButtonOpt "-activeforeground \"$fsBox(activeForeground)\" "
}
if {"$fsBox(background)" != ""} {
append tmpButtonOpt "-background \"$fsBox(background)\" "
}
if {"$fsBox(font)" != ""} {
append tmpButtonOpt "-font \"$fsBox(font)\" "
}
if {"$fsBox(foreground)" != ""} {
append tmpButtonOpt "-foreground \"$fsBox(foreground)\" "
}
set fsBox(pattern) $fsBoxPattern
if {[file exists $fsBoxPath] && [file readable $fsBoxPath] &&
[IsADir $fsBoxPath]} {
set fsBox(internalPath) $fsBoxPath
} {
if {[file exists $fsBoxPath] && [file readable $fsBoxPath] &&
[IsAFile $fsBoxPath]} {
set fsBox(internalPath) [file dirname $fsBoxPath]
.fsBox.file.file delete 0 end
.fsBox.file.file insert 0 [file tail $fsBoxPath]
set fsBoxPath $fsBox(internalPath)
} {
while {"$fsBoxPath" != "" && "$fsBoxPath" != "/" &&
![file isdirectory $fsBoxPath]} {
set fsBox(internalPath) [file dirname $fsBoxPath]
set fsBoxPath $fsBox(internalPath)
}
}
}
if {"$fsBoxPath" == ""} {
set fsBoxPath "/"
set fsBox(internalPath) "/"
}
.fsBox.path.path delete 0 end
.fsBox.path.path insert 0 $fsBox(internalPath)
if {[.fsBox.files.files size] > 0} {
.fsBox.files.files delete 0 end
}
if {$fsBoxAll} {
if {[catch "exec ls -F -a $fsBoxPath" fsBoxResult]} {
puts stderr "$fsBoxResult"
}
} {
if {[catch "exec ls -F $fsBoxPath" fsBoxResult]} {
puts stderr "$fsBoxResult"
}
}
set fsBoxElementList [lsort $fsBoxResult]
foreach fsBoxCounter [winfo children .fsBox.pattern.patterns.patterns] {
if {[string length [info commands XFDestroy]] > 0} {
catch {XFDestroy $fsBoxCounter}
} {
catch {destroy $fsBoxCounter}
}
}
menu .fsBox.pattern.patterns.patterns.menu
catch ".fsBox.pattern.patterns.patterns.menu config $tmpButtonOpt"
if {$fsBox(extensions)} {
.fsBox.pattern.patterns.patterns.menu add command -label "*" -command {
global fsBox
set fsBox(pattern) "*"
.fsBox.pattern.pattern delete 0 end
.fsBox.pattern.pattern insert 0 $fsBox(pattern)
FSBoxFSShow [.fsBox.path.path get] $fsBox(pattern) $fsBox(all)}
}
if {"$fsBoxPath" != "/"} {
.fsBox.files.files insert end "../"
}
foreach fsBoxCounter $fsBoxElementList {
if {[string match $fsBoxPattern $fsBoxCounter] ||
[IsADir [string trimright $fsBoxPath/$fsBoxCounter "/@"]]} {
if {"$fsBoxCounter" != "../" &&
"$fsBoxCounter" != "./"} {
.fsBox.files.files insert end $fsBoxCounter
}
}
if {$fsBox(extensions)} {
catch "file rootname $fsBoxCounter" fsBoxRootName
catch "file extension $fsBoxCounter" fsBoxExtension
set fsBoxExtension [string trimright $fsBoxExtension "/*@"]
if {"$fsBoxExtension" != "" && "$fsBoxRootName" != ""} {
set fsBoxInsert 1
set fsBoxLast [.fsBox.pattern.patterns.patterns.menu index last]
for {set fsBoxCounter1 0} {$fsBoxCounter1 <= $fsBoxLast} {incr fsBoxCounter1 1} {
if {"*$fsBoxExtension" == "[lindex [.fsBox.pattern.patterns.patterns.menu entryconfigure $fsBoxCounter1 -label] 4]"} {
set fsBoxInsert 0
}
}
if {$fsBoxInsert} {
.fsBox.pattern.patterns.patterns.menu add command -label "*$fsBoxExtension" -command "
global fsBox
set fsBox(pattern) \"*$fsBoxExtension\"
.fsBox.pattern.pattern delete 0 end
.fsBox.pattern.pattern insert 0 \$fsBox(pattern)
FSBoxFSShow \[.fsBox.path.path get\] \$fsBox(pattern) \$fsBox(all)"
}
}
}
}
if {$fsBox(extensions)} {
.fsBox.pattern.patterns.patterns.menu add separator
}
if {$fsBox(extensions) ||
"[.fsBox.pattern.patterns.patterns.menu index last]" == "none"} {
.fsBox.pattern.patterns.patterns.menu add checkbutton -label "Scan extensions" -variable "fsBox(extensions)" -command {
global fsBox
FSBoxFSShow [.fsBox.path.path get] [.fsBox.pattern.pattern get] $fsBox(all)}
}
}
# Procedure: FdInList
proc FdInList { listWidget {fileInFile ""}} {
# xf ignore me 5
##########
# Procedure: FdInList
# Description: fill a list with the contents of a filedescriptor
# Arguments: listWidget - the widget
# {fileInFile} - a filedescriptor to read. The descriptor
# is closed after reading
# Returns: none
# Sideeffects: the list widget is filled
# Notes: there exists also a function called:
# FileInList - to open and read a file automatically
##########
# check file existance
if {"$fileInFile" == ""} {
puts stderr "no filedescriptor specified"
return
}
set listValue [read $fileInFile]
close $fileInFile
foreach fileLine [split $listValue "\n"] {
$listWidget insert end $fileLine
}
}
# Procedure: FdInText
proc FdInText { textWidget {fileInFile ""}} {
# xf ignore me 5
##########
# Procedure: FdInText
# Description: fill a text with the contents of a filedescriptor
# Arguments: textWidget - the widget
# {fileInFile} - a filedescriptor to read. The descriptor
# is closed after reading
# Returns: none
# Sideeffects: the text widget is filled
# Notes: there exists also a function called:
# FileInText - to open and read a file automatically
##########
# check file existance
if {"$fileInFile" == ""} {
puts stderr "no filedescriptor specified"
return
}
set textValue [read $fileInFile]
$textWidget insert end "$textValue"
close $fileInFile
}
# Procedure: FileInList
proc FileInList { listWidget {fileName ""}} {
# xf ignore me 5
##########
# Procedure: FileInList
# Description: fill a list with the contents of the file
# Arguments: listWidget - the widget
# {fileName} - filename to read
# Returns: none
# Sideeffects: the list widget is filled
# Notes: there exists also a function called:
# FdInList - to read from an already opened filedescriptor
##########
# check file existance
if {"$fileName" == ""} {
puts stderr "no filename specified"
return
}
if {[catch "open $fileName r" fileInFile]} {
puts stderr "$fileInFile"
return
}
set listValue [read $fileInFile]
close $fileInFile
foreach fileLine [split $listValue "\n"] {
$listWidget insert end $fileLine
}
}
# Procedure: FileInText
proc FileInText { textWidget {fileName ""}} {
# xf ignore me 5
##########
# Procedure: FileInText
# Description: fill a text with the contents of the file
# Arguments: textWidget - the widget
# {fileName} - filename to read
# Returns: none
# Sideeffects: the text widget is filled
# Notes: there exists also a function called:
# FdInText - to read from an already opened filedescriptor
##########
# check file existance
if {"$fileName" == ""} {
puts stderr "no filename specified"
return
}
if {[catch "open $fileName r" fileInFile]} {
puts stderr "$fileInFile"
return
}
set textValue [read $fileInFile]
$textWidget insert end "$textValue"
close $fileInFile
}
# Procedure: ForgetWindow
proc ForgetWindow { args} {
foreach i $args {
pack forget $i
}
}
# Procedure: InputBoxInternal
proc InputBoxInternal { inputBoxMessage inputBoxCommandOk inputBoxCommandCancel inputBoxGeometry inputBoxTitle lineNum} {
# xf ignore me 6
global inputBox
set tmpButtonOpt ""
set tmpFrameOpt ""
set tmpMessageOpt ""
set tmpScaleOpt ""
set tmpScrollOpt ""
if {"$inputBox(activeBackground)" != ""} {
append tmpButtonOpt "-activebackground \"$inputBox(activeBackground)\" "
}
if {"$inputBox(activeForeground)" != ""} {
append tmpButtonOpt "-activeforeground \"$inputBox(activeForeground)\" "
}
if {"$inputBox(background)" != ""} {
append tmpButtonOpt "-background \"$inputBox(background)\" "
append tmpFrameOpt "-background \"$inputBox(background)\" "
append tmpMessageOpt "-background \"$inputBox(background)\" "
}
if {"$inputBox(font)" != ""} {
append tmpButtonOpt "-font \"$inputBox(font)\" "
append tmpMessageOpt "-font \"$inputBox(font)\" "
}
if {"$inputBox(foreground)" != ""} {
append tmpButtonOpt "-foreground \"$inputBox(foreground)\" "
append tmpMessageOpt "-foreground \"$inputBox(foreground)\" "
}
if {"$inputBox(scrollActiveForeground)" != ""} {
append tmpScrollOpt "-activeforeground \"$inputBox(scrollActiveForeground)\" "
}
if {"$inputBox(scrollBackground)" != ""} {
append tmpScrollOpt "-background \"$inputBox(scrollBackground)\" "
}
if {"$inputBox(scrollForeground)" != ""} {
append tmpScrollOpt "-foreground \"$inputBox(scrollForeground)\" "
}
# start build of toplevel
if {"[info commands XFDestroy]" != ""} {
catch {XFDestroy $inputBox(toplevelName)}
} {
catch {destroy $inputBox(toplevelName)}
}
toplevel $inputBox(toplevelName) -borderwidth 0
catch "$inputBox(toplevelName) config $tmpFrameOpt"
if {[catch "wm geometry $inputBox(toplevelName) $inputBoxGeometry"]} {
wm geometry $inputBox(toplevelName) 350x150
}
wm title $inputBox(toplevelName) $inputBoxTitle
wm maxsize $inputBox(toplevelName) 1000 1000
wm minsize $inputBox(toplevelName) 100 100
# end build of toplevel
message $inputBox(toplevelName).message1 -anchor "$inputBox(anchor)" -justify "$inputBox(justify)" -relief raised -text "$inputBoxMessage"
catch "$inputBox(toplevelName).message1 config $tmpMessageOpt"
set xfTmpWidth [string range $inputBoxGeometry 0 [expr [string first x $inputBoxGeometry]-1]]
if {"$xfTmpWidth" != ""} {
# set message size
catch "$inputBox(toplevelName).message1 configure -width [expr $xfTmpWidth-10]"
} {
$inputBox(toplevelName).message1 configure -aspect 1500
}
frame $inputBox(toplevelName).topmenubar -borderwidth 0 -relief raised
catch "$inputBox(toplevelName).topmenubar config $tmpFrameOpt"
frame $inputBox(toplevelName).frame1 -borderwidth 0 -relief raised
catch "$inputBox(toplevelName).frame1 config $tmpFrameOpt"
if {$lineNum == 1} {
scrollbar $inputBox(toplevelName).frame1.hscroll -orient "horizontal" -relief raised -command "$inputBox(toplevelName).frame1.input view"
catch "$inputBox(toplevelName).frame1.hscroll config $tmpScrollOpt"
entry $inputBox(toplevelName).frame1.input -relief raised -scrollcommand "$inputBox(toplevelName).frame1.hscroll set"
catch "$inputBox(toplevelName).frame1.input config $tmpMessageOpt"
$inputBox(toplevelName).frame1.input insert 0 $inputBox($inputBox(toplevelName),inputOne)
# bindings
bind $inputBox(toplevelName).frame1.input <Return> "
global inputBox
set inputBox($inputBox(toplevelName),inputOne) \[$inputBox(toplevelName).frame1.input get\]
if {\"\[info commands XFDestroy\]\" != \"\"} {
catch {XFDestroy $inputBox(toplevelName)}
} {
catch {destroy $inputBox(toplevelName)}
}
$inputBoxCommandOk"
# packing
pack append $inputBox(toplevelName).frame1 $inputBox(toplevelName).frame1.hscroll {bottom fill} $inputBox(toplevelName).frame1.input {top fill expand}
} {
text $inputBox(toplevelName).frame1.input -relief raised -wrap none -borderwidth 2 -yscrollcommand "$inputBox(toplevelName).frame1.vscroll set"
catch "$inputBox(toplevelName).frame1.input config $tmpMessageOpt"
scrollbar $inputBox(toplevelName).frame1.vscroll -relief raised -command "$inputBox(toplevelName).frame1.input yview"
catch "$inputBox(toplevelName).frame1.vscroll config $tmpScrollOpt"
$inputBox(toplevelName).frame1.input insert 1.0 $inputBox($inputBox(toplevelName),inputMulti)
# bindings
bind $inputBox(toplevelName).frame1.input <Control-Return> "
global inputBox
set inputBox($inputBox(toplevelName),inputMulti) \[$inputBox(toplevelName).frame1.input get 1.0 end\]
if {\"\[info commands XFDestroy\]\" != \"\"} {
catch {XFDestroy $inputBox(toplevelName)}
} {
catch {destroy $inputBox(toplevelName)}
}
$inputBoxCommandOk"
bind $inputBox(toplevelName).frame1.input <Meta-Return> "
global inputBox
set inputBox($inputBox(toplevelName),inputMulti) \[$inputBox(toplevelName).frame1.input get 1.0 end\]
if {\"\[info commands XFDestroy\]\" != \"\"} {
catch {XFDestroy $inputBox(toplevelName)}
} {
catch {destroy $inputBox(toplevelName)}
}
$inputBoxCommandOk"
# packing
pack append $inputBox(toplevelName).frame1 $inputBox(toplevelName).frame1.vscroll "$inputBox(scrollSide) filly" $inputBox(toplevelName).frame1.input {left fill expand}
}
button $inputBox(toplevelName).topmenubar.okButton -text "OK" -command "
global inputBox
if {$lineNum == 1} {
set inputBox($inputBox(toplevelName),inputOne) \[$inputBox(toplevelName).frame1.input get\]
} {
set inputBox($inputBox(toplevelName),inputMulti) \[$inputBox(toplevelName).frame1.input get 1.0 end\]
}
if {\"\[info commands XFDestroy\]\" != \"\"} {
catch {XFDestroy $inputBox(toplevelName)}
} {
catch {destroy $inputBox(toplevelName)}
}
$inputBoxCommandOk"
catch "$inputBox(toplevelName).topmenubar.okButton config $tmpButtonOpt"
button $inputBox(toplevelName).topmenubar.button1 -text "Cancel" -command "
global inputBox
if {$lineNum == 1} {
set inputBox($inputBox(toplevelName),inputOne) \"\"
} {
set inputBox($inputBox(toplevelName),inputMulti) \"\"
}
if {\"\[info commands XFDestroy\]\" != \"\"} {
catch {XFDestroy $inputBox(toplevelName)}
} {
catch {destroy $inputBox(toplevelName)}
}
$inputBoxCommandCancel"
catch "$inputBox(toplevelName).topmenubar.button1 config $tmpButtonOpt"
pack append $inputBox(toplevelName).topmenubar $inputBox(toplevelName).topmenubar.okButton {left fill expand} $inputBox(toplevelName).topmenubar.button1 {left fill expand}
pack append $inputBox(toplevelName) $inputBox(toplevelName).topmenubar {bottom fill} $inputBox(toplevelName).frame1 {bottom fill expand} $inputBox(toplevelName).message1 {top fill}
}
# Procedure: IsADir
proc IsADir { pathName} {
# xf ignore me 5
##########
# Procedure: IsADir
# Description: check if name is a directory (including symbolic links)
# Arguments: pathName - the path to check
# Returns: 1 if its a directory, otherwise 0
# Sideeffects: none
##########
if {[file isdirectory $pathName]} {
return 1
} {
catch "file type $pathName" fileType
if {"$fileType" == "link"} {
if {[catch "file readlink $pathName" linkName]} {
return 0
}
catch "file type $linkName" fileType
while {"$fileType" == "link"} {
if {[catch "file readlink $linkName" linkName]} {
return 0
}
catch "file type $linkName" fileType
}
return [file isdirectory $linkName]
}
}
return 0
}
# Procedure: IsAFile
proc IsAFile { fileName} {
# xf ignore me 5
##########
# Procedure: IsAFile
# Description: check if filename is a file (including symbolic links)
# Arguments: fileName - the filename to check
# Returns: 1 if its a file, otherwise 0
# Sideeffects: none
##########
if {[file isfile $fileName]} {
return 1
} {
catch "file type $fileName" fileType
if {"$fileType" == "link"} {
if {[catch "file readlink $fileName" linkName]} {
return 0
}
catch "file type $linkName" fileType
while {"$fileType" == "link"} {
if {[catch "file readlink $linkName" linkName]} {
return 0
}
catch "file type $linkName" fileType
}
return [file isfile $linkName]
}
}
return 0
}
# Procedure: IsASymlink
proc IsASymlink { fileName} {
# xf ignore me 5
##########
# Procedure: IsASymlink
# Description: check if filename is a symbolic link
# Arguments: fileName - the path/filename to check
# Returns: none
# Sideeffects: none
##########
catch "file type $fileName" fileType
if {"$fileType" == "link"} {
return 1
}
return 0
}
# Procedure: TextBox
proc TextBox { {textBoxMessage "Text message"} {textBoxCommand ""} {textBoxGeometry "350x150"} {textBoxTitle "Text box"} args} {
# xf ignore me 5
##########
# Procedure: TextBox
# Description: show text box
# Arguments: {textBoxMessage} - the text to display
# {textBoxCommand} - the command to call after ok
# {textBoxGeometry} - the geometry for the window
# {textBoxTitle} - the title for the window
# {args} - labels of buttons
# Returns: The number of the selected button, or nothing
# Sideeffects: none
# Notes: there exist also functions called:
# TextBoxFile - to open and read a file automatically
# TextBoxFd - to read from an already opened filedescriptor
##########
#
# global textBox(activeBackground) - active background color
# global textBox(activeForeground) - active foreground color
# global textBox(background) - background color
# global textBox(font) - text font
# global textBox(foreground) - foreground color
# global textBox(scrollActiveForeground) - scrollbar active background color
# global textBox(scrollBackground) - scrollbar background color
# global textBox(scrollForeground) - scrollbar foreground color
# global textBox(scrollSide) - side where scrollbar is located
global textBox
set textBox(activeBackground) "#bfbfbf"
set textBox(activeForeground) "black"
set textBox(background) "#bfbfbf"
set textBox(scrollBackground) "#bfbfbf"
set textBox(scrollForeground) "#bfbfbf"
set textBox(scrollActiveForeground) "#bfbfbf"
set textBox(scrollSide) "right"
# show text box
if {[llength $args] > 0} {
eval TextBoxInternal "\{$textBoxMessage\}" "\{$textBoxCommand\}" "\{$textBoxGeometry\}" "\{$textBoxTitle\}" $args
} {
TextBoxInternal $textBoxMessage $textBoxCommand $textBoxGeometry $textBoxTitle
}
if {[llength $args] > 0} {
# wait for the box to be destroyed
update idletask
grab $textBox(toplevelName)
tkwait window $textBox(toplevelName)
return $textBox(button)
}
}
# Procedure: TextBoxFd
proc TextBoxFd { {textBoxInFile ""} {textBoxCommand ""} {textBoxGeometry "350x150"} {textBoxTitle "Text box"} args} {
# xf ignore me 5
##########
# Procedure: TextBoxFd
# Description: show text box containing a filedescriptor
# Arguments: {textBoxInFile} - a filedescriptor to read. The descriptor
# is closed after reading
# {textBoxCommand} - the command to call after ok
# {textBoxGeometry} - the geometry for the window
# {textBoxTitle} - the title for the window
# {args} - labels of buttons
# Returns: The number of the selected button, ot nothing
# Sideeffects: none
# Notes: there exist also functions called:
# TextBox - to display a passed string
# TextBoxFile - to open and read a file automatically
##########
#
# global textBox(activeBackground) - active background color
# global textBox(activeForeground) - active foreground color
# global textBox(background) - background color
# global textBox(font) - text font
# global textBox(foreground) - foreground color
# global textBox(scrollActiveForeground) - scrollbar active background color
# global textBox(scrollBackground) - scrollbar background color
# global textBox(scrollForeground) - scrollbar foreground color
# global textBox(scrollSide) - side where scrollbar is located
global textBox
# check file existance
if {"$textBoxInFile" == ""} {
puts stderr "No filedescriptor specified"
return
}
set textBoxMessage [read $textBoxInFile]
close $textBoxInFile
# show text box
if {[llength $args] > 0} {
eval TextBoxInternal "\{$textBoxMessage\}" "\{$textBoxCommand\}" "\{$textBoxGeometry\}" "\{$textBoxTitle\}" $args
} {
TextBoxInternal $textBoxMessage $textBoxCommand $textBoxGeometry $textBoxTitle
}
if {[llength $args] > 0} {
# wait for the box to be destroyed
update idletask
grab $textBox(toplevelName)
tkwait window $textBox(toplevelName)
return $textBox(button)
}
}
# Procedure: TextBoxFile
proc TextBoxFile { {textBoxFile ""} {textBoxCommand ""} {textBoxGeometry "350x150"} {textBoxTitle "Text box"} args} {
# xf ignore me 5
##########
# Procedure: TextBoxFile
# Description: show text box containing a file
# Arguments: {textBoxFile} - filename to read
# {textBoxCommand} - the command to call after ok
# {textBoxGeometry} - the geometry for the window
# {textBoxTitle} - the title for the window
# {args} - labels of buttons
# Returns: The number of the selected button, ot nothing
# Sideeffects: none
# Notes: there exist also functions called:
# TextBox - to display a passed string
# TextBoxFd - to read from an already opened filedescriptor
##########
#
# global textBox(activeBackground) - active background color
# global textBox(activeForeground) - active foreground color
# global textBox(background) - background color
# global textBox(font) - text font
# global textBox(foreground) - foreground color
# global textBox(scrollActiveForeground) - scrollbar active background color
# global textBox(scrollBackground) - scrollbar background color
# global textBox(scrollForeground) - scrollbar foreground color
# global textBox(scrollSide) - side where scrollbar is located
global textBox
# check file existance
if {"$textBoxFile" == ""} {
puts stderr "No filename specified"
return
}
if {[catch "open $textBoxFile r" textBoxInFile]} {
puts stderr "$textBoxInFile"
return
}
set textBoxMessage [read $textBoxInFile]
close $textBoxInFile
# show text box
if {[llength $args] > 0} {
eval TextBoxInternal "\{$textBoxMessage\}" "\{$textBoxCommand\}" "\{$textBoxGeometry\}" "\{$textBoxTitle\}" $args
} {
TextBoxInternal $textBoxMessage $textBoxCommand $textBoxGeometry $textBoxTitle
}
if {[llength $args] > 0} {
# wait for the box to be destroyed
update idletask
grab $textBox(toplevelName)
tkwait window $textBox(toplevelName)
return $textBox(button)
}
}
# Procedure: TextBoxInternal
proc TextBoxInternal { textBoxMessage textBoxCommand textBoxGeometry textBoxTitle args} {
# xf ignore me 6
global textBox
set tmpButtonOpt ""
set tmpFrameOpt ""
set tmpMessageOpt ""
set tmpScrollOpt ""
if {"$textBox(activeBackground)" != ""} {
append tmpButtonOpt "-activebackground \"$textBox(activeBackground)\" "
}
if {"$textBox(activeForeground)" != ""} {
append tmpButtonOpt "-activeforeground \"$textBox(activeForeground)\" "
}
if {"$textBox(background)" != ""} {
append tmpButtonOpt "-background \"$textBox(background)\" "
append tmpFrameOpt "-background \"$textBox(background)\" "
append tmpMessageOpt "-background \"$textBox(background)\" "
}
if {"$textBox(font)" != ""} {
append tmpButtonOpt "-font \"$textBox(font)\" "
append tmpMessageOpt "-font \"$textBox(font)\" "
}
if {"$textBox(foreground)" != ""} {
append tmpButtonOpt "-foreground \"$textBox(foreground)\" "
append tmpMessageOpt "-foreground \"$textBox(foreground)\" "
}
if {"$textBox(scrollActiveForeground)" != ""} {
append tmpScrollOpt "-activeforeground \"$textBox(scrollActiveForeground)\" "
}
if {"$textBox(scrollBackground)" != ""} {
append tmpScrollOpt "-background \"$textBox(scrollBackground)\" "
}
if {"$textBox(scrollForeground)" != ""} {
append tmpScrollOpt "-foreground \"$textBox(scrollForeground)\" "
}
# start build of toplevel
if {"[info commands XFDestroy]" != ""} {
catch {XFDestroy $textBox(toplevelName)}
} {
catch {destroy $textBox(toplevelName)}
}
toplevel $textBox(toplevelName) -borderwidth 0
catch "$textBox(toplevelName) config $tmpFrameOpt"
if {[catch "wm geometry $textBox(toplevelName) $textBoxGeometry"]} {
wm geometry $textBox(toplevelName) 350x150
}
wm title $textBox(toplevelName) $textBoxTitle
wm maxsize $textBox(toplevelName) 1000 1000
wm minsize $textBox(toplevelName) 100 100
# end build of toplevel
frame $textBox(toplevelName).topmenubar -borderwidth 0 -relief raised
catch "$textBox(toplevelName).topmenubar config $tmpFrameOpt"
text $textBox(toplevelName).topmenubar.text1 -relief raised -wrap none -borderwidth 2 -yscrollcommand "$textBox(toplevelName).topmenubar.vscroll set"
catch "$textBox(toplevelName).topmenubar.text1 config $tmpMessageOpt"
scrollbar $textBox(toplevelName).topmenubar.vscroll -relief raised -command "$textBox(toplevelName).topmenubar.text1 yview"
catch "$textBox(toplevelName).topmenubar.vscroll config $tmpScrollOpt"
frame $textBox(toplevelName).frame1 -borderwidth 0 -relief raised
catch "$textBox(toplevelName).frame1 config $tmpFrameOpt"
set textBoxCounter 0
set buttonNum [llength $args]
if {$buttonNum > 0} {
while {$textBoxCounter < $buttonNum} {
button $textBox(toplevelName).frame1.button$textBoxCounter -text "[lindex $args $textBoxCounter]" -command "
global textBox
set textBox(button) $textBoxCounter
set textBox(contents) \[$textBox(toplevelName).topmenubar.text1 get 1.0 end\]
if {\"\[info commands XFDestroy\]\" != \"\"} {
catch {XFDestroy $textBox(toplevelName)}
} {
catch {destroy $textBox(toplevelName)}
}"
catch "$textBox(toplevelName).frame1.button$textBoxCounter config $tmpButtonOpt"
pack append $textBox(toplevelName).frame1 $textBox(toplevelName).frame1.button$textBoxCounter {left fillx expand}
incr textBoxCounter
}
} {
button $textBox(toplevelName).frame1.button0 -text "OK" -command "
global textBox
set textBox(button) 0
set textBox(contents) \[$textBox(toplevelName).topmenubar.text1 get 1.0 end\]
if {\"\[info commands XFDestroy\]\" != \"\"} {
catch {XFDestroy $textBox(toplevelName)}
} {
catch {destroy $textBox(toplevelName)}
}
$textBoxCommand"
catch "$textBox(toplevelName).frame1.button0 config $tmpButtonOpt"
pack append $textBox(toplevelName).frame1 $textBox(toplevelName).frame1.button0 {left fillx expand}
}
$textBox(toplevelName).topmenubar.text1 insert end "$textBoxMessage"
$textBox(toplevelName).topmenubar.text1 config -state $textBox(state)
# packing
pack append $textBox(toplevelName).topmenubar $textBox(toplevelName).topmenubar.vscroll "$textBox(scrollSide) filly" $textBox(toplevelName).topmenubar.text1 {left fill expand}
pack append $textBox(toplevelName) $textBox(toplevelName).frame1 {bottom fill} $textBox(toplevelName).topmenubar {top fill expand}
}
# Procedure: WriteVars
proc WriteVars { writeToFile} {
global choosemethod packmethod writemethod formatalways verifyformat verifyalways verifywrite mnr mdens
set f1 [open $writeToFile w+]
set setname [getsetname $setnameselection]
puts $f1 "export pre_choosemethod=$choosemethod"
puts $f1 "export pre_packmethod=$packmethod"
puts $f1 "export pre_writemethod=$writemethod"
puts $f1 "export pre_mnr=$mnr"
puts $f1 "export pre_formatalways=$formatalways"
puts $f1 "export pre_verifyformat=$verifyformat"
puts $f1 "export pre_verifywrite=$verifywrite"
puts $f1 "export pre_setname=$setname"
puts $f1 "export mdens=$mdens"
close $f1
}
# Procedure: fileselect.cancel.cmd
proc fileselect.cancel.cmd { w} {
# xf ignore me 6
# puts stderr "Cancel"
if {"[info commands XFDestroy]" != ""} {
catch {XFDestroy $w}
} {
catch {destroy $w}
}
}
# Procedure: fileselect.ok.cmd
proc fileselect.ok.cmd { w cmd} {
# xf ignore me 6
global fileselect_entry fileselect_dirlabel fileselect_list
set selected [$fileselect_entry get]
if {[file isdirectory $selected] != 0} {
cd $selected
set dir [exec pwd]
eval $fileselect_dirlabel configure -text $dir
eval $fileselect_entry delete 0 end
eval $fileselect_list delete 0 end
foreach i [exec ls -a $dir] {
if {[string compare $i "."] != 0} {
eval $fileselect_list insert end $i
}
}
return
}
if {"[info commands XFDestroy]" != ""} {
catch {XFDestroy $w}
} {
catch {destroy $w}
}
eval $cmd \"$selected\"
}
# Procedure: getsetname
proc getsetname { setnameselection} {
global setnameselection
set setstring [string trim $setnameselection \{\}] ; #get rid of the "{}'s
set returnval [string trim [lrange $setstring 0 0]]
return $returnval
}
# Procedure: lreplaceit
proc lreplaceit { list value newval} {
set ix [lsearch -exact $list $value]
if {$ix >= 0} {
set newlist [lreplace $list $ix $ix $newval ]
return [lreplaceit $newlist $value $newval ]
} else {
return $list
}
}
# Procedure: opensetfilelist
proc opensetfilelist { setfilelistname} {
set fd [open $setfilelistname w]
#pop the info into the file...
puts $fd [exec /usr/lib/tbackup/bin/listsets]
close $fd
set fd [open $setfilelistname r]
set alist [read $fd] ; #put the contents of the file in a list struct
close $fd
set fd [open $setfilelistname w]
set setfilelist [join [lreplaceit [lreplaceit $alist # \-\-] \[END\] \n]]
puts $fd $setfilelist
close $fd
set lengthofthislist [llength $setfilelist]
return $lengthofthislist ; Want it to return # of lines!
}
# Internal procedures
# Procedure: Alias
if {"[info procs Alias]" == ""} {
proc Alias { args} {
# xf ignore me 7
##########
# Procedure: Alias
# Description: establish an alias for a procedure
# Arguments: args - no argument means that a list of all aliases
# is returned. Otherwise the first parameter is
# the alias name, and the second parameter is
# the procedure that is aliased.
# Returns: nothing, the command that is bound to the alias or a
# list of all aliases - command pairs.
# Sideeffects: internalAliasList is updated, and the alias
# proc is inserted
##########
global internalAliasList
if {[llength $args] == 0} {
return $internalAliasList
} {
if {[llength $args] == 1} {
set xfTmpIndex [lsearch $internalAliasList "[lindex $args 0] *"]
if {$xfTmpIndex != -1} {
return [lindex [lindex $internalAliasList $xfTmpIndex] 1]
}
} {
if {[llength $args] == 2} {
eval "proc [lindex $args 0] {args} {#xf ignore me 4
return \[eval \"[lindex $args 1] \$args\"\]}"
set xfTmpIndex [lsearch $internalAliasList "[lindex $args 0] *"]
if {$xfTmpIndex != -1} {
set internalAliasList [lreplace $internalAliasList $xfTmpIndex $xfTmpIndex "[lindex $args 0] [lindex $args 1]"]
} {
lappend internalAliasList "[lindex $args 0] [lindex $args 1]"
}
} {
error "Alias: wrong number or args: $args"
}
}
}
}
}
# Procedure: GetSelection
if {"[info procs GetSelection]" == ""} {
proc GetSelection {} {
# xf ignore me 7
##########
# Procedure: GetSelection
# Description: get current selection
# Arguments: none
# Returns: none
# Sideeffects: none
##########
# the save way
set xfSelection ""
catch "selection get" xfSelection
if {"$xfSelection" == "selection doesn't exist or form \"STRING\" not defined"} {
return ""
} {
return $xfSelection
}
}
}
# Procedure: MenuPopupAdd
if {"[info procs MenuPopupAdd]" == ""} {
proc MenuPopupAdd { xfW xfButton xfMenu {xfModifier ""} {xfCanvasTag ""}} {
# xf ignore me 7
# the popup menu handling is from (I already gave up with popup handling :-):
#
# Copyright 1991,1992 by James Noble.
# Everyone is granted permission to copy, modify and redistribute.
# This notice must be preserved on all copies or derivates.
#
##########
# Procedure: MenuPopupAdd
# Description: attach a popup menu to widget
# Arguments: xfW - the widget
# xfButton - the button we use
# xfMenu - the menu to attach
# {xfModifier} - a optional modifier
# {xfCanvasTag} - a canvas tagOrId
# Returns: none
# Sideeffects: none
##########
global tk_popupPriv
set tk_popupPriv($xfMenu,focus) ""
set tk_popupPriv($xfMenu,grab) ""
if {"$xfModifier" != ""} {
set press "$xfModifier-"
set motion "$xfModifier-"
set release "Any-"
} {
set press ""
set motion ""
set release ""
}
bind $xfMenu "<${motion}B${xfButton}-Motion>" "MenuPopupMotion $xfMenu %W %X %Y"
bind $xfMenu "<${release}ButtonRelease-${xfButton}>" "MenuPopupRelease $xfMenu %W"
if {"$xfCanvasTag" == ""} {
bind $xfW "<${press}ButtonPress-${xfButton}>" "MenuPopupPost $xfMenu %X %Y"
bind $xfW "<${release}ButtonRelease-${xfButton}>" "MenuPopupRelease $xfMenu %W"
} {
$xfW bind $xfCanvasTag "<${press}ButtonPress-${xfButton}>" "MenuPopupPost $xfMenu %X %Y"
$xfW bind $xfCanvasTag "<${release}ButtonRelease-${xfButton}>" "MenuPopupRelease $xfMenu %W"
}
}
}
# Procedure: MenuPopupMotion
if {"[info procs MenuPopupMotion]" == ""} {
proc MenuPopupMotion { xfMenu xfW xfX xfY} {
# xf ignore me 7
##########
# Procedure: MenuPopupMotion
# Description: handle the popup menu motion
# Arguments: xfMenu - the topmost menu
# xfW - the menu
# xfX - the root x coordinate
# xfY - the root x coordinate
# Returns: none
# Sideeffects: none
##########
global tk_popupPriv
if {"[info commands $xfW]" != "" && [winfo ismapped $xfW] &&
"[winfo class $xfW]" == "Menu" &&
[info exists tk_popupPriv($xfMenu,focus)] &&
"$tk_popupPriv($xfMenu,focus)" != "" &&
[info exists tk_popupPriv($xfMenu,grab)] &&
"$tk_popupPriv($xfMenu,grab)" != ""} {
set xfPopMinX [winfo rootx $xfW]
set xfPopMaxX [expr $xfPopMinX+[winfo width $xfW]]
if {$xfX >= $xfPopMinX && $xfX <= $xfPopMaxX} {
$xfW activate @[expr $xfY-[winfo rooty $xfW]]
if {![catch "$xfW entryconfig @[expr $xfY-[winfo rooty $xfW]] -menu" result]} {
if {"[lindex $result 4]" != ""} {
foreach binding [bind $xfMenu] {
bind [lindex $result 4] $binding [bind $xfMenu $binding]
}
}
}
} {
$xfW activate none
}
}
}
}
# Procedure: MenuPopupPost
if {"[info procs MenuPopupPost]" == ""} {
proc MenuPopupPost { xfMenu xfX xfY} {
# xf ignore me 7
##########
# Procedure: MenuPopupPost
# Description: post the popup menu
# Arguments: xfMenu - the menu
# xfX - the root x coordinate
# xfY - the root x coordinate
# Returns: none
# Sideeffects: none
##########
global tk_popupPriv
if {"[info commands $xfMenu]" != ""} {
if {![info exists tk_popupPriv($xfMenu,focus)]} {
set tk_popupPriv($xfMenu,focus) [focus]
} {
if {"$tk_popupPriv($xfMenu,focus)" == ""} {
set tk_popupPriv($xfMenu,focus) [focus]
}
}
set tk_popupPriv($xfMenu,grab) $xfMenu
catch "$xfMenu activate none"
catch "$xfMenu post $xfX $xfY"
catch "focus $xfMenu"
catch "grab -global $xfMenu"
}
}
}
# Procedure: MenuPopupRelease
if {"[info procs MenuPopupRelease]" == ""} {
proc MenuPopupRelease { xfMenu xfW} {
# xf ignore me 7
##########
# Procedure: MenuPopupRelease
# Description: remove the popup menu
# Arguments: xfMenu - the topmost menu widget
# xfW - the menu widget
# Returns: none
# Sideeffects: none
##########
global tk_popupPriv
global tkVersion
if {"[info commands $xfW]" != "" && [winfo ismapped $xfW] &&
"[winfo class $xfW]" == "Menu" &&
[info exists tk_popupPriv($xfMenu,focus)] &&
"$tk_popupPriv($xfMenu,focus)" != "" &&
[info exists tk_popupPriv($xfMenu,grab)] &&
"$tk_popupPriv($xfMenu,grab)" != ""} {
if {$tkVersion >= 3.0} {
catch "grab release $tk_popupPriv($xfMenu,grab)"
} {
catch "grab none"
}
catch "focus $tk_popupPriv($xfMenu,focus)"
set tk_popupPriv($xfMenu,focus) ""
set tk_popupPriv($xfMenu,grab) ""
if {"[$xfW index active]" != "none"} {
$xfW invoke active; catch "$xfMenu unpost"
}
}
catch "$xfMenu unpost"
}
}
# Procedure: NoFunction
if {"[info procs NoFunction]" == ""} {
proc NoFunction { args} {
# xf ignore me 7
##########
# Procedure: NoFunction
# Description: do nothing (especially with scales and scrollbars)
# Arguments: args - a number of ignored parameters
# Returns: none
# Sideeffects: none
##########
}
}
# Procedure: SN
if {"[info procs SN]" == ""} {
proc SN { {xfName ""}} {
# xf ignore me 7
##########
# Procedure: SN
# Description: map a symbolic name to the widget path
# Arguments: xfName
# Returns: the symbolic name
# Sideeffects: none
##########
SymbolicName $xfName
}
}
# Procedure: SymbolicName
if {"[info procs SymbolicName]" == ""} {
proc SymbolicName { {xfName ""}} {
# xf ignore me 7
##########
# Procedure: SymbolicName
# Description: map a symbolic name to the widget path
# Arguments: xfName
# Returns: the symbolic name
# Sideeffects: none
##########
global symbolicName
if {"$xfName" != ""} {
set xfArrayName ""
append xfArrayName symbolicName ( $xfName )
if {![catch "set \"$xfArrayName\"" xfValue]} {
return $xfValue
} {
if {"[info commands XFProcError]" != ""} {
XFProcError "Unknown symbolic name:\n$xfName"
} {
puts stderr "XF error: unknown symbolic name:\n$xfName"
}
}
}
return ""
}
}
# Procedure: Unalias
if {"[info procs Unalias]" == ""} {
proc Unalias { aliasName} {
# xf ignore me 7
##########
# Procedure: Unalias
# Description: remove an alias for a procedure
# Arguments: aliasName - the alias name to remove
# Returns: none
# Sideeffects: internalAliasList is updated, and the alias
# proc is removed
##########
global internalAliasList
set xfIndex [lsearch $internalAliasList "$aliasName *"]
if {$xfIndex != -1} {
rename $aliasName ""
set internalAliasList [lreplace $internalAliasList $xfIndex $xfIndex]
}
}
}
# application parsing procedure
proc XFLocalParseAppDefs {xfAppDefFile} {
global xfAppDefaults
# basically from: Michael Moore
if {[file exists $xfAppDefFile] &&
[file readable $xfAppDefFile] &&
"[file type $xfAppDefFile]" == "link"} {
catch "file type $xfAppDefFile" xfType
while {"$xfType" == "link"} {
if {[catch "file readlink $xfAppDefFile" xfAppDefFile]} {
return
}
catch "file type $xfAppDefFile" xfType
}
}
if {!("$xfAppDefFile" != "" &&
[file exists $xfAppDefFile] &&
[file readable $xfAppDefFile] &&
"[file type $xfAppDefFile]" == "file")} {
return
}
if {![catch "open $xfAppDefFile r" xfResult]} {
set xfAppFileContents [read $xfResult]
close $xfResult
foreach line [split $xfAppFileContents "\n"] {
# backup indicates how far to backup. It applies to the
# situation where a resource name ends in . and when it
# ends in *. In the second case you want to keep the *
# in the widget name for pattern matching, but you want
# to get rid of the . if it is the end of the name.
set backup -2
set line [string trim $line]
if {[string index $line 0] == "#" || "$line" == ""} {
# skip comments and empty lines
continue
}
set list [split $line ":"]
set resource [string trim [lindex $list 0]]
set i [string last "." $resource]
set j [string last "*" $resource]
if {$j > $i} {
set i $j
set backup -1
}
incr i
set name [string range $resource $i end]
incr i $backup
set widname [string range $resource 0 $i]
set value [string trim [lindex $list 1]]
if {"$widname" != "" && "$widname" != "*"} {
# insert the widget and resourcename to the application
# defaults list.
if {![info exists xfAppDefaults]} {
set xfAppDefaults ""
}
lappend xfAppDefaults [list $widname [string tolower $name] $value]
}
}
}
}
# application loading procedure
proc XFLocalLoadAppDefs {{xfClasses ""} {xfPriority "startupFile"} {xfAppDefFile ""}} {
global env
if {"$xfAppDefFile" == ""} {
set xfFileList ""
if {[info exists env(XUSERFILESEARCHPATH)]} {
append xfFileList [split $env(XUSERFILESEARCHPATH) :]
}
if {[info exists env(XAPPLRESDIR)]} {
append xfFileList [split $env(XAPPLRESDIR) :]
}
if {[info exists env(XFILESEARCHPATH)]} {
append xfFileList [split $env(XFILESEARCHPATH) :]
}
append xfFileList " /usr/lib/X11/app-defaults"
append xfFileList " /usr/X11/lib/X11/app-defaults"
foreach xfCounter1 $xfClasses {
foreach xfCounter2 $xfFileList {
set xfPathName $xfCounter2
if {[regsub -all "%N" "$xfPathName" "$xfCounter1" xfResult]} {
set xfPathName $xfResult
}
if {[regsub -all "%T" "$xfPathName" "app-defaults" xfResult]} {
set xfPathName $xfResult
}
if {[regsub -all "%S" "$xfPathName" "" xfResult]} {
set xfPathName $xfResult
}
if {[regsub -all "%C" "$xfPathName" "" xfResult]} {
set xfPathName $xfResult
}
if {[file exists $xfPathName] &&
[file readable $xfPathName] &&
("[file type $xfPathName]" == "file" ||
"[file type $xfPathName]" == "link")} {
catch "option readfile $xfPathName $xfPriority"
if {"[info commands XFParseAppDefs]" != ""} {
XFParseAppDefs $xfPathName
} {
if {"[info commands XFLocalParseAppDefs]" != ""} {
XFLocalParseAppDefs $xfPathName
}
}
} {
if {[file exists $xfCounter2/$xfCounter1] &&
[file readable $xfCounter2/$xfCounter1] &&
("[file type $xfCounter2/$xfCounter1]" == "file" ||
"[file type $xfCounter2/$xfCounter1]" == "link")} {
catch "option readfile $xfCounter2/$xfCounter1 $xfPriority"
if {"[info commands XFParseAppDefs]" != ""} {
XFParseAppDefs $xfCounter2/$xfCounter1
} {
if {"[info commands XFLocalParseAppDefs]" != ""} {
XFLocalParseAppDefs $xfCounter2/$xfCounter1
}
}
}
}
}
}
} {
# load a specific application defaults file
if {[file exists $xfAppDefFile] &&
[file readable $xfAppDefFile] &&
("[file type $xfAppDefFile]" == "file" ||
"[file type $xfAppDefFile]" == "link")} {
catch "option readfile $xfAppDefFile $xfPriority"
if {"[info commands XFParseAppDefs]" != ""} {
XFParseAppDefs $xfAppDefFile
} {
if {"[info commands XFLocalParseAppDefs]" != ""} {
XFLocalParseAppDefs $xfAppDefFile
}
}
}
}
}
# application setting procedure
proc XFLocalSetAppDefs {{xfWidgetPath "."}} {
global xfAppDefaults
if {![info exists xfAppDefaults]} {
return
}
foreach xfCounter $xfAppDefaults {
if {"$xfCounter" == ""} {
break
}
set widname [lindex $xfCounter 0]
if {[string match $widname ${xfWidgetPath}] ||
[string match "${xfWidgetPath}*" $widname]} {
set name [string tolower [lindex $xfCounter 1]]
set value [lindex $xfCounter 2]
# Now lets see how many tcl commands match the name
# pattern specified.
set widlist [info command $widname]
if {"$widlist" != ""} {
foreach widget $widlist {
# make sure this command is a widget.
if {![catch "winfo id $widget"] &&
[string match "${xfWidgetPath}*" $widget]} {
catch "$widget configure -$name $value"
}
}
}
}
}
}
# prepare auto loading
global auto_path
global tk_library
global xfLoadPath
foreach xfElement [eval list [split $xfLoadPath :] $auto_path] {
if {[file exists $xfElement/tclIndex]} {
lappend auto_path $xfElement
}
}
catch "unset auto_index"
catch "unset auto_oldpath"
catch "unset auto_execs"
# initialize global variables
proc InitGlobals {} {
global {argfilename}
set {argfilename} {/etc/tbackup/new.arg}
global {choosemethod}
set {choosemethod} {set}
global {fileselect_cancel}
set {fileselect_cancel} {.fileSelectWindow.bframe.cancel}
global {fileselect_dirlabel}
set {fileselect_dirlabel} {.fileSelectWindow.file.dirlabel}
global {fileselect_entry}
set {fileselect_entry} {.fileSelectWindow.file.eframe.entry}
global {fileselect_list}
set {fileselect_list} {.fileSelectWindow.file.sframe.list}
global {fileselect_ok}
set {fileselect_ok} {.fileSelectWindow.bframe.okframe.ok}
global {format}
set {format} {0}
global {formatalways}
set {formatalways} {n}
global {fsBox}
set {fsBox(activeBackground)} {#bfbfbf}
set {fsBox(activeForeground)} {}
set {fsBox(all)} {1}
set {fsBox(background)} {#bfbfbf}
set {fsBox(button)} {0}
set {fsBox(extensions)} {0}
set {fsBox(font)} {}
set {fsBox(foreground)} {}
set {fsBox(internalPath)} {/etc/tbackup}
set {fsBox(name)} {}
set {fsBox(path)} {}
set {fsBox(pattern)} {*.arg}
set {fsBox(scrollActiveForeground)} {#bfbfbf}
set {fsBox(scrollBackground)} {#bfbfbf}
set {fsBox(scrollForeground)} {#bfbfbf}
set {fsBox(scrollSide)} {right}
set {fsBox(showPixmap)} {0}
global {inputBox}
set {inputBox(activeBackground)} {}
set {inputBox(activeForeground)} {}
set {inputBox(anchor)} {n}
set {inputBox(background)} {}
set {inputBox(erase)} {1}
set {inputBox(font)} {}
set {inputBox(foreground)} {}
set {inputBox(justify)} {center}
set {inputBox(scrollActiveForeground)} {}
set {inputBox(scrollBackground)} {}
set {inputBox(scrollForeground)} {}
set {inputBox(scrollSide)} {left}
set {inputBox(toplevelName)} {.inputBox}
global {level}
set {level} {f}
global {mdens}
set {mdens} {d}
global {mnr}
set {mnr} {0}
global {packmethod}
set {packmethod} {afio}
global {readBox}
set {readBox(activeBackground)} {}
set {readBox(activeForeground)} {}
set {readBox(background)} {}
set {readBox(font)} {}
set {readBox(foreground)} {}
set {readBox(scrollActiveForeground)} {}
set {readBox(scrollBackground)} {}
set {readBox(scrollForeground)} {}
set {readBox(scrollSide)} {left}
global {result}
set {result} {7}
global {select}
set {select} {text doesn't contain any characters tagged with "sel"}
global {selection}
set {selection} {{ system -- root filesystem, without /root dir.}}
global {setfiled}
set {setfiled} {/tmp/.tktbackup.set}
global {setnameselection}
set {setnameselection} {{ system -- root filesystem, without /root dir. }}
global {temp}
set {temp} {}
global {textBox}
set {textBox(activeBackground)} {#bfbfbf}
set {textBox(activeForeground)} {black}
set {textBox(background)} {#bfbfbf}
set {textBox(button)} {0}
set {textBox(contents)} {tktbackup by jonM<><
jonboy@neuromancer.ucr.edu
http://indyunix.iupui.edu/~jmmadiso/tktbackup.html}
set {textBox(font)} {}
set {textBox(foreground)} {}
set {textBox(scrollActiveForeground)} {#bfbfbf}
set {textBox(scrollBackground)} {#bfbfbf}
set {textBox(scrollForeground)} {#bfbfbf}
set {textBox(scrollSide)} {right}
set {textBox(state)} {disabled}
set {textBox(toplevelName)} {.textBox}
global {verify_after_write}
set {verify_after_write} {0}
global {verify_format}
set {verify_format} {n}
global {verifyformat}
set {verifyformat} {n}
global {verifywrite}
set {verifywrite} {n}
global {writemethod}
set {writemethod} {floppy}
global {xh}
set {xh} {}
# please don't modify the following
# variables. They are needed by xf.
global {autoLoadList}
set {autoLoadList(tktbackup.xf)} {0}
global {internalAliasList}
set {internalAliasList} {}
global {moduleList}
set {moduleList(tktbackup.xf)} {}
global {preloadList}
set {preloadList(xfInternal)} {}
global {symbolicName}
set {symbolicName(About)} {.topmenubar.menubutton2.m}
set {symbolicName(About Box)} {.top0}
set {symbolicName(Helpmenubutton)} {.topmenubar.menubutton2}
set {symbolicName(OKbutton)} {.top0.button1}
set {symbolicName(TkTbackupRootroot)} {.}
set {symbolicName(UseBackupSetList)} {.chooseMethodFrame.frame.listbox1}
set {symbolicName(aboutmenubutton)} {.topmenubar.menubutton1.m}
set {symbolicName(backItUp)} {.topmenubar.actionmenu.m}
set {symbolicName(choosesetbox)} {.top1.frame}
set {symbolicName(horizontalscrollforlistbox)} {.scrollbar1}
set {symbolicName(nulldescript)} {.writeMethodFrame.message2}
set {symbolicName(one)} {.chooseMethodFrame.chooseMethodButtonsFrame.one}
set {symbolicName(pack_descriptions)} {.packMethodsFrame.text0}
set {symbolicName(root)} {.}
set {symbolicName(setchooserlistbox)} {.chooseMethodFrame.frame1.listbox0}
set {symbolicName(setfilelistbox)} {.chooseMethodFrame.frame}
set {symbolicName(setnamelist)} {.chooseMethodFrame.frame1}
global {xfWmSetPosition}
set {xfWmSetPosition} {.top0 .aboutBox .filedescriptionwindow}
global {xfWmSetSize}
set {xfWmSetSize} {. .top0 .top1 .aboutBox .filedescriptionwindow}
global {xfAppDefToplevels}
set {xfAppDefToplevels} {}
}
# initialize global variables
InitGlobals
# display/remove toplevel windows.
ShowWindow.
global xfShowWindow.aboutBox
set xfShowWindow.aboutBox 0
global xfShowWindow.filedescriptionwindow
set xfShowWindow.filedescriptionwindow 0
# load default bindings.
if {[info exists env(XF_BIND_FILE)] &&
"[info procs XFShowHelp]" == ""} {
source $env(XF_BIND_FILE)
}
# parse and apply application defaults.
XFLocalLoadAppDefs Tktbackup
XFLocalSetAppDefs
# eof
#